mirror of
https://github.com/datahub-project/datahub.git
synced 2025-07-27 11:29:59 +00:00
47 lines
1.6 KiB
TypeScript
47 lines
1.6 KiB
TypeScript
import { findChartByURN } from '@graphql-mock/fixtures/searchResult/chartSearchResult';
|
|
import { updateEntityOwners, updateEntityTag } from '@graphql-mock/mutationHelper';
|
|
import { Chart, ChartUpdateInput } from '@types';
|
|
|
|
type UpdateChart = {
|
|
data: { updateChart: Chart };
|
|
};
|
|
|
|
export const updateChartResolver = {
|
|
updateChart({ variables: { urn, input } }): UpdateChart {
|
|
const { globalTags, ownership }: ChartUpdateInput = input;
|
|
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',
|
|
},
|
|
}),
|
|
},
|
|
};
|
|
},
|
|
};
|