Skip to content

Commit

Permalink
feat: import legacy projects api events (#1047)
Browse files Browse the repository at this point in the history
* feat: import legacy projects api events

* feat: import legacy projects piece api events
  • Loading branch information
aciddaute authored May 9, 2022
1 parent 327c7d4 commit 3eebb8e
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { MigrationInterface, QueryRunner } from 'typeorm';

export class AddImportLegacyProjectsApiEvents1652099652734
implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
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<void> {
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';`,
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,16 @@ const eventToJobStatusMapping: Record<ValuesType<ProjectEvents>, 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,
};
6 changes: 6 additions & 0 deletions api/libs/api-events/src/api-event-kinds.enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<
Expand Down

0 comments on commit 3eebb8e

Please sign in to comment.