From e24aafe8e8879bccd17dc7e5bff0691f62ae375e Mon Sep 17 00:00:00 2001 From: Florian Date: Mon, 30 Oct 2023 16:46:47 +0100 Subject: [PATCH] fix: eslint back --- backend/back/src/database.ts | 4 +- .../back/src/webhooks/webhooks.controller.ts | 12 ++-- ...98678924392-CreateGitlabCommitPRActions.ts | 70 ++++++++++--------- 3 files changed, 45 insertions(+), 41 deletions(-) diff --git a/backend/back/src/database.ts b/backend/back/src/database.ts index 291db337..6ae3264e 100644 --- a/backend/back/src/database.ts +++ b/backend/back/src/database.ts @@ -61,9 +61,7 @@ import { CreateGoogleFormUpdateDescriptionArea1698654637708 } from "./workflows/ import { CreateGoogleFormConvertToQuizArea1698655334570 } from "./workflows/seed/1698655334570-CreateGoogleFormConvertToQuizArea"; import { CreateGoogleUpdateSpreadsheetTitleArea1698656017859 } from "./workflows/seed/1698656017859-CreateGoogleUpdateSpreadsheetTitleArea"; import { CreateLinearCreateIssueAreas1698614949784 } from "./workflows/seed/1698614949784-CreateLinearCreateIssueAreas"; -import { - CreateGitlabCommitPRActions1698678924392 -} from "./workflows/seed/1698678924392-CreateGitlabCommitPRActions"; +import { CreateGitlabCommitPRActions1698678924392 } from "./workflows/seed/1698678924392-CreateGitlabCommitPRActions"; dotenv.config(); diff --git a/backend/back/src/webhooks/webhooks.controller.ts b/backend/back/src/webhooks/webhooks.controller.ts index f1217e06..39295f91 100644 --- a/backend/back/src/webhooks/webhooks.controller.ts +++ b/backend/back/src/webhooks/webhooks.controller.ts @@ -9,8 +9,8 @@ import { GitlabWebhookService } from "./services/gitlab-webhook.service"; export class WebhooksController { constructor( private readonly githubWebhookService: GithubWebhookService, - private readonly gitlabWebhookService: GitlabWebhookService, - private readonly linearWebhookService: LinearWebhookService, + private readonly gitlabWebhookService: GitlabWebhookService, + private readonly linearWebhookService: LinearWebhookService, ) {} @Post("github") @@ -18,10 +18,10 @@ export class WebhooksController { return this.githubWebhookService.onGithubWebhook(signature, body); } - @Post("gitlab") - async onGitlabWebhook(@Headers("X-Gitlab-Token") token: string, @Body() body: unknown): Promise { - return this.gitlabWebhookService.onGitlabWebhook(token, body); - } + @Post("gitlab") + async onGitlabWebhook(@Headers("X-Gitlab-Token") token: string, @Body() body: unknown): Promise { + return this.gitlabWebhookService.onGitlabWebhook(token, body); + } @Post("linear") async onLinearWebhook(@Headers("linear-signature") signature: string, @Body() body: unknown): Promise { diff --git a/backend/back/src/workflows/seed/1698678924392-CreateGitlabCommitPRActions.ts b/backend/back/src/workflows/seed/1698678924392-CreateGitlabCommitPRActions.ts index e35f9eef..caba0b66 100644 --- a/backend/back/src/workflows/seed/1698678924392-CreateGitlabCommitPRActions.ts +++ b/backend/back/src/workflows/seed/1698678924392-CreateGitlabCommitPRActions.ts @@ -1,50 +1,56 @@ -import { MigrationInterface, QueryRunner } from "typeorm" -import {ParametersFormFlowFieldDto} from "../../services/dto/area.dto"; +import { MigrationInterface, QueryRunner } from "typeorm"; +import { ParametersFormFlowFieldDto } from "../../services/dto/area.dto"; export class CreateGitlabCommitPRActions1698678924392 implements MigrationInterface { - - private readonly gitlabActionsParametersFormFlow: ParametersFormFlowFieldDto[] = [ - { - name: "projectId", - type: "short-text", - required: true, - }, - ]; - - private readonly gitlabOnCommitParameters: string[] = ["author", "branch", "createdAt", "message", "url"]; - private readonly gitlabOnPullRequestParameters: string[] = ["author", "base", "compare", "createdAt", "description", "title", "url"]; - - public async up(queryRunner: QueryRunner): Promise { - const commitParams = `'{${this.gitlabOnCommitParameters.map((v) => `"${v}"`).join(",")}}'` - const pullRequestParams = `'{${this.gitlabOnPullRequestParameters.map((v) => `"${v}"`).join(",")}}'` - - await queryRunner.query( - `INSERT INTO "area" ("id", "service_id", "is_action", "description", "parameters_form_flow", "parameters_return_flow") + private readonly gitlabActionsParametersFormFlow: ParametersFormFlowFieldDto[] = [ + { + name: "projectId", + type: "short-text", + required: true, + }, + ]; + + private readonly gitlabOnCommitParameters: string[] = ["author", "branch", "createdAt", "message", "url"]; + private readonly gitlabOnPullRequestParameters: string[] = [ + "author", + "base", + "compare", + "createdAt", + "description", + "title", + "url", + ]; + + public async up(queryRunner: QueryRunner): Promise { + const commitParams = `'{${this.gitlabOnCommitParameters.map((v) => `"${v}"`).join(",")}}'`; + const pullRequestParams = `'{${this.gitlabOnPullRequestParameters.map((v) => `"${v}"`).join(",")}}'`; + + await queryRunner.query( + `INSERT INTO "area" ("id", "service_id", "is_action", "description", "parameters_form_flow", "parameters_return_flow") VALUES ('on-commit', 'gitlab', true, 'Triggers when an commit is pushed on a Gitlab project', $1, ${commitParams}), ('on-pull-request-close', 'gitlab', true, 'Triggers when a merge request is closed on a Gitlab project', $1, ${pullRequestParams}), ('on-pull-request-create', 'gitlab', true, 'Triggers when a merge request is created on a Gitlab project', $1, ${pullRequestParams}), ('on-pull-request-merge', 'gitlab', true, 'Triggers when a merge request is merged on a Gitlab project', $1, ${pullRequestParams}), ('on-pull-request-reopen', 'gitlab', true, 'Triggers when a merge request is merged on a Gitlab project', $1, ${pullRequestParams})`, - [JSON.stringify(this.gitlabActionsParametersFormFlow)], - ); + [JSON.stringify(this.gitlabActionsParametersFormFlow)], + ); - await queryRunner.query( - `INSERT INTO "area_service_scopes_needed_service_scope" ("area_id", "area_service_id", "service_scope_id", "service_scope_service_id") + await queryRunner.query( + `INSERT INTO "area_service_scopes_needed_service_scope" ("area_id", "area_service_id", "service_scope_id", "service_scope_service_id") VALUES ('on-commit', 'gitlab', 'api', 'gitlab'), ('on-pull-request-close', 'gitlab', 'api', 'gitlab'), ('on-pull-request-create', 'gitlab', 'api', 'gitlab'), ('on-pull-request-merge', 'github', 'api', 'gitlab'), ('on-pull-request-merge', 'gitlab', 'api', 'gitlab') `, - ); - } + ); + } - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `DELETE FROM "area" + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `DELETE FROM "area" WHERE service_id = 'gitlab' AND id IN ('on-commit', 'on-pull-request-close', 'on-pull-request-create', 'on-pull-request-merge', 'on-pull-request-reopen')`, - ); - } - + ); + } }