Skip to content

Commit

Permalink
fix: eslint back
Browse files Browse the repository at this point in the history
  • Loading branch information
EdenComp authored and RezaRahemtola committed Oct 30, 2023
1 parent 7702cac commit e24aafe
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 41 deletions.
4 changes: 1 addition & 3 deletions backend/back/src/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
12 changes: 6 additions & 6 deletions backend/back/src/webhooks/webhooks.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ 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")
async onGithubWebhook(@Headers("X-Hub-Signature-256") signature: string, @Body() body: unknown): Promise<void> {
return this.githubWebhookService.onGithubWebhook(signature, body);
}

@Post("gitlab")
async onGitlabWebhook(@Headers("X-Gitlab-Token") token: string, @Body() body: unknown): Promise<void> {
return this.gitlabWebhookService.onGitlabWebhook(token, body);
}
@Post("gitlab")
async onGitlabWebhook(@Headers("X-Gitlab-Token") token: string, @Body() body: unknown): Promise<void> {
return this.gitlabWebhookService.onGitlabWebhook(token, body);
}

@Post("linear")
async onLinearWebhook(@Headers("linear-signature") signature: string, @Body() body: unknown): Promise<void> {
Expand Down
Original file line number Diff line number Diff line change
@@ -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<void> {
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<void> {
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<void> {
await queryRunner.query(
`DELETE FROM "area"
public async down(queryRunner: QueryRunner): Promise<void> {
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')`,
);
}

);
}
}

0 comments on commit e24aafe

Please sign in to comment.