From 9dc9e492ff42529dd2b9f337c121ea49df775491 Mon Sep 17 00:00:00 2001 From: Santhosh Vasabhaktula Date: Thu, 12 Sep 2024 12:33:18 +0530 Subject: [PATCH] #OBS-I203: Remove the archived and purged status transition from the API --- .../DatasetStatusTransition.ts | 24 ++++--------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/api-service/src/controllers/DatasetStatusTransition/DatasetStatusTransition.ts b/api-service/src/controllers/DatasetStatusTransition/DatasetStatusTransition.ts index c2a18021..c97b19c5 100644 --- a/api-service/src/controllers/DatasetStatusTransition/DatasetStatusTransition.ts +++ b/api-service/src/controllers/DatasetStatusTransition/DatasetStatusTransition.ts @@ -18,11 +18,9 @@ const allowedTransitions: Record = { Delete: [DatasetStatus.Draft, DatasetStatus.ReadyToPublish], ReadyToPublish: [DatasetStatus.Draft], Live: [DatasetStatus.ReadyToPublish], - Retire: [DatasetStatus.Live], - Archive: [DatasetStatus.Retired], - Purge: [DatasetStatus.Archived] + Retire: [DatasetStatus.Live] } -const liveDatasetActions = ["Retire", "Archive", "Purge"] +const liveDatasetActions = ["Retire"] const validateRequest = (req: Request, datasetId: any) => { const isRequestValid: Record = schemaValidation(req.body, StatusTransitionSchema) @@ -70,12 +68,8 @@ const datasetStatusTransition = async (req: Request, res: Response) => { case "Retire": await retireDataset(dataset); break; - case "Archive": - await archiveDataset(dataset); - break; - case "Purge": - await purgeDataset(dataset); - break; + default: + throw obsrvError(dataset.id, "UNKNOWN_STATUS_TRANSITION", "Unknown status transition requested", "BAD_REQUEST", 400) } ResponseHandler.successResponse(req, res, { status: httpStatus.OK, data: { message: `Dataset status transition to ${status} successful`, dataset_id } }); @@ -239,14 +233,4 @@ export const restartPipeline = async (dataset: Record) => { return executeCommand(dataset.id, "RESTART_PIPELINE") } -const archiveDataset = async (dataset: Record) => { - - throw obsrvError(dataset.id, "ARCHIVE_NOT_IMPLEMENTED", "Archive functionality is not implemented", "NOT_IMPLEMENTED", 501) -} - -const purgeDataset = async (dataset: Record) => { - - throw obsrvError(dataset.id, "PURGE_NOT_IMPLEMENTED", "Purge functionality is not implemented", "NOT_IMPLEMENTED", 501) -} - export default datasetStatusTransition; \ No newline at end of file