2025-04-16 16:55:38 -07:00
|
|
|
import { findChartByURN } from '@graphql-mock/fixtures/searchResult/chartSearchResult';
|
|
|
|
import { updateEntityOwners, updateEntityTag } from '@graphql-mock/mutationHelper';
|
|
|
|
import { Chart, ChartUpdateInput } from '@types';
|
2021-07-17 04:56:50 +10:00
|
|
|
|
|
|
|
type UpdateChart = {
|
|
|
|
data: { updateChart: Chart };
|
|
|
|
};
|
|
|
|
|
|
|
|
export const updateChartResolver = {
|
2021-09-22 17:30:15 -07:00
|
|
|
updateChart({ variables: { urn, input } }): UpdateChart {
|
|
|
|
const { globalTags, ownership }: ChartUpdateInput = input;
|
2021-07-17 04:56:50 +10:00
|
|
|
const chart = findChartByURN(urn);
|
|
|
|
|
|
|
|
if (ownership) {
|
|
|
|
updateEntityOwners({ entity: chart, owners: ownership?.owners });
|
|
|
|
} else if (globalTags) {
|
|
|
|
updateEntityTag({ entity: chart, globalTags });
|
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
|
|
data: {
|
|
|
|
updateChart: Object.assign(chart, {
|
|
|
|
info: {
|
|
|
|
...chart.info,
|
|
|
|
inputs: [],
|
|
|
|
customProperties: [],
|
|
|
|
lastRefreshed: null,
|
|
|
|
created: {
|
|
|
|
time: 1619160920,
|
|
|
|
__typename: 'AuditStamp',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
query: null,
|
|
|
|
downstreamLineage: {
|
|
|
|
entities: [],
|
|
|
|
__typename: 'DownstreamEntityRelationships',
|
|
|
|
},
|
|
|
|
upstreamLineage: {
|
|
|
|
entities: [],
|
|
|
|
__typename: 'UpstreamEntityRelationships',
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
};
|
|
|
|
},
|
|
|
|
};
|