mirror of
https://github.com/datahub-project/datahub.git
synced 2025-07-28 20:09:59 +00:00
27 lines
835 B
TypeScript
27 lines
835 B
TypeScript
import { DataJob, DataJobUpdateInput } from '../../types.generated';
|
|
import { findDataJobByURN } from '../fixtures/searchResult/dataJobSearchResult';
|
|
import { updateEntityOwners, updateEntityTag } from '../mutationHelper';
|
|
|
|
type UpdateDataJob = {
|
|
data: { updateDataJob: DataJob };
|
|
};
|
|
|
|
export const updateDataJobResolver = {
|
|
updateDataJob({ variables: { urn, input } }): UpdateDataJob {
|
|
const { ownership, globalTags }: DataJobUpdateInput = input;
|
|
const dataJob = findDataJobByURN(urn);
|
|
|
|
if (ownership) {
|
|
updateEntityOwners({ entity: dataJob, owners: ownership?.owners });
|
|
} else if (globalTags) {
|
|
updateEntityTag({ entity: dataJob, globalTags });
|
|
}
|
|
|
|
return {
|
|
data: {
|
|
updateDataJob: dataJob,
|
|
},
|
|
};
|
|
},
|
|
};
|