diff --git a/api/apps/api/src/migrations/api/1652099652734-AddImportLegacyProjectsApiEvents.ts b/api/apps/api/src/migrations/api/1652099652734-AddImportLegacyProjectsApiEvents.ts new file mode 100644 index 0000000000..92bbd15ac0 --- /dev/null +++ b/api/apps/api/src/migrations/api/1652099652734-AddImportLegacyProjectsApiEvents.ts @@ -0,0 +1,42 @@ +import { MigrationInterface, QueryRunner } from 'typeorm'; + +export class AddImportLegacyProjectsApiEvents1652099652734 + implements MigrationInterface { + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(` + INSERT INTO api_event_kinds (id) values + ('project.legacy.import.submitted/v1/alpha'), + ('project.legacy.import.finished/v1/alpha'), + ('project.legacy.import.failed/v1/alpha'), + ('project.legacy.import.piece.submitted/v1/alpha'), + ('project.legacy.import.piece.finished/v1/alpha'), + ('project.legacy.import.piece.failed/v1/alpha'); + `); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `DELETE FROM api_event_kinds WHERE id = 'project.legacy.import.submitted/v1/alpha';`, + ); + + await queryRunner.query( + `DELETE FROM api_event_kinds WHERE id = 'project.legacy.import.finished/v1/alpha';`, + ); + + await queryRunner.query( + `DELETE FROM api_event_kinds WHERE id = 'project.legacy.import.failed/v1/alpha';`, + ); + + await queryRunner.query( + `DELETE FROM api_event_kinds WHERE id = 'project.legacy.import.piece.submitted/v1/alpha';`, + ); + + await queryRunner.query( + `DELETE FROM api_event_kinds WHERE id = 'project.legacy.import.piece.finished/v1/alpha';`, + ); + + await queryRunner.query( + `DELETE FROM api_event_kinds WHERE id = 'project.legacy.import.piece.failed/v1/alpha';`, + ); + } +} diff --git a/api/apps/api/src/modules/projects/job-status/project-status.view.api.entity.ts b/api/apps/api/src/modules/projects/job-status/project-status.view.api.entity.ts index caceba79ee..3fcfb662a5 100644 --- a/api/apps/api/src/modules/projects/job-status/project-status.view.api.entity.ts +++ b/api/apps/api/src/modules/projects/job-status/project-status.view.api.entity.ts @@ -76,4 +76,16 @@ const eventToJobStatusMapping: Record, JobStatus> = { [API_EVENT_KINDS.project__clone__failed__v1__alpha]: JobStatus.failure, [API_EVENT_KINDS.project__clone__finished__v1__alpha]: JobStatus.done, [API_EVENT_KINDS.project__clone__submitted__v1__alpha]: JobStatus.running, + [API_EVENT_KINDS.project__legacy__import__failed__v1__alpha]: + JobStatus.failure, + [API_EVENT_KINDS.project__legacy__import__finished__v1__alpha]: + JobStatus.done, + [API_EVENT_KINDS.project__legacy__import__submitted__v1__alpha]: + JobStatus.running, + [API_EVENT_KINDS.project__legacy__import__piece__failed__v1__alpha]: + JobStatus.failure, + [API_EVENT_KINDS.project__legacy__import__piece__finished__v1__alpha]: + JobStatus.done, + [API_EVENT_KINDS.project__legacy__import__piece__submitted__v1__alpha]: + JobStatus.running, }; diff --git a/api/libs/api-events/src/api-event-kinds.enum.ts b/api/libs/api-events/src/api-event-kinds.enum.ts index 560754bce2..75dddf89d6 100644 --- a/api/libs/api-events/src/api-event-kinds.enum.ts +++ b/api/libs/api-events/src/api-event-kinds.enum.ts @@ -82,6 +82,12 @@ export enum API_EVENT_KINDS { scenario__clone__submitted__v1__alpha = 'scenario.clone.submitted/v1/alpha', scenario__clone__finished__v1__alpha = 'scenario.clone.finished/v1/alpha', scenario__clone__failed__v1__alpha = 'scenario.clone.failed/v1/alpha', + project__legacy__import__submitted__v1__alpha = 'project.legacy.import.submitted/v1/alpha', + project__legacy__import__finished__v1__alpha = 'project.legacy.import.finished/v1/alpha', + project__legacy__import__failed__v1__alpha = 'project.legacy.import.failed/v1/alpha', + project__legacy__import__piece__submitted__v1__alpha = 'project.legacy.import.piece.submitted/v1/alpha', + project__legacy__import__piece__finished__v1__alpha = 'project.legacy.import.piece.finished/v1/alpha', + project__legacy__import__piece__failed__v1__alpha = 'project.legacy.import.piece.failed/v1/alpha', } export type ProjectEvents = Pick<