mirror of
https://github.com/datahub-project/datahub.git
synced 2025-07-27 11:29:59 +00:00
44 lines
1.5 KiB
TypeScript
44 lines
1.5 KiB
TypeScript
import { findDatasetByURN } from '@graphql-mock/fixtures/searchResult/datasetSearchResult';
|
|
import { Dataset, InstitutionalMemory, InstitutionalMemoryMetadata } from '@types';
|
|
|
|
type GetDataset = {
|
|
data: { dataset: Dataset };
|
|
};
|
|
|
|
export const getDatasetResolver = {
|
|
getDataset({ variables: { urn } }): GetDataset {
|
|
const dataset = findDatasetByURN(urn);
|
|
|
|
if (!dataset.institutionalMemory) {
|
|
const baseElements: InstitutionalMemoryMetadata[] = [];
|
|
const baseInstitutionalMemory: InstitutionalMemory = {
|
|
elements: baseElements,
|
|
__typename: 'InstitutionalMemory',
|
|
};
|
|
dataset.institutionalMemory = baseInstitutionalMemory;
|
|
}
|
|
|
|
return {
|
|
data: {
|
|
dataset: Object.assign(dataset, {
|
|
schema: null,
|
|
editableProperties: null,
|
|
editableSchemaMetadata: null,
|
|
deprecation: null,
|
|
downstreamLineage: {
|
|
entities: [],
|
|
__typename: 'DownstreamEntityRelationships',
|
|
},
|
|
upstreamLineage: {
|
|
entities: [],
|
|
__typename: 'UpstreamEntityRelationships',
|
|
},
|
|
glossaryTerms: null,
|
|
institutionalMemory: null,
|
|
usageStats: null,
|
|
}),
|
|
},
|
|
};
|
|
},
|
|
};
|