diff --git a/src/controllers/dimension-processor.ts b/src/controllers/dimension-processor.ts index b2bb55e..b10097d 100644 --- a/src/controllers/dimension-processor.ts +++ b/src/controllers/dimension-processor.ts @@ -43,10 +43,10 @@ export const validateDimensionCreationRequest = async ( } footnotes = sourceInfo; break; - case SourceType.DIMENSION: + case SourceType.Dimension: dimensions.push(sourceInfo); break; - case SourceType.IGNORE: + case SourceType.Ignore: ignore.push(sourceInfo); break; default: @@ -59,16 +59,16 @@ export const validateDimensionCreationRequest = async ( async function createUpdateDatavalues(sourceDescriptor: DimensionCreationDTO) { const dataValuesSource = await Source.findOneByOrFail({ id: sourceDescriptor.sourceId }); - dataValuesSource.action = SourceAction.CREATE; - dataValuesSource.type = SourceType.DATAVALUES; + dataValuesSource.action = SourceAction.Create; + dataValuesSource.type = SourceType.DataValues; await Source.createQueryBuilder().relation(Source, 'dimension').of(dataValuesSource).set(null); await dataValuesSource.save(); } async function createUpdateIngoredSources(sourceDescriptor: DimensionCreationDTO) { const ignoreSource = await Source.findOneByOrFail({ id: sourceDescriptor.sourceId }); - ignoreSource.action = SourceAction.IGNORE; - ignoreSource.type = SourceType.IGNORE; + ignoreSource.action = SourceAction.Ignore; + ignoreSource.type = SourceType.Ignore; await Source.createQueryBuilder().relation(Source, 'dimension').of(ignoreSource).set(null); await ignoreSource.save(); } @@ -80,11 +80,11 @@ async function createUpdateFootnotesDimension( sourceDescriptor: DimensionCreationDTO ) { const footnoteSource = await Source.findOneByOrFail({ id: sourceDescriptor.sourceId }); - if (footnoteSource.type !== SourceType.FOOTNOTES) { - footnoteSource.type = SourceType.FOOTNOTES; + if (footnoteSource.type !== SourceType.FootNotes) { + footnoteSource.type = SourceType.FootNotes; } const existingFootnotesDimension = existingDimensions.find( - (dimension) => dimension.type === DimensionType.FOOTNOTE + (dimension) => dimension.type === DimensionType.FootNote ); if (existingFootnotesDimension) { footnoteSource.dimension = Promise.resolve(existingFootnotesDimension); @@ -120,7 +120,7 @@ async function createDimension( ) { const checkSource = await Source.findOneByOrFail({ id: sourceDescriptor.sourceId }); const existingDimension = await checkSource.dimension; - if (existingDimension && checkSource.type === SourceType.DIMENSION) { + if (existingDimension && checkSource.type === SourceType.Dimension) { logger.debug(`No Dimension to create as Source for column ${checkSource.csvField} is already attached to one`); return; } diff --git a/src/route/dataset.ts b/src/route/dataset.ts index 7f5a8a5..32d2f31 100644 --- a/src/route/dataset.ts +++ b/src/route/dataset.ts @@ -559,7 +559,7 @@ router.delete( const importRecord = await validateImport(importID, res); if (!importRecord) return; try { - if (importRecord.location === DataLocation.DATA_LAKE) { + if (importRecord.location === DataLocation.DataLake) { logger.warn('User has requested to remove a fact table from the datalake. This is unusual.'); await removeFileFromDatalake(importRecord); const sources = await importRecord.sources; diff --git a/test/publisher-journey.test.ts b/test/publisher-journey.test.ts index 0e61229..792023c 100644 --- a/test/publisher-journey.test.ts +++ b/test/publisher-journey.test.ts @@ -450,7 +450,7 @@ describe('API Endpoints', () => { const testFileImportId = crypto.randomUUID().toLowerCase(); await createSmallDataset(testDatasetId, testRevisionId, testFileImportId, user); const importRecord = await FileImport.findOneByOrFail({ id: testFileImportId }); - importRecord.location = DataLocation.DATA_LAKE; + importRecord.location = DataLocation.DataLake; await importRecord.save(); DataLakeService.prototype.deleteFile = jest.fn().mockReturnValue(true); const res = await request(app)