2026-05-31 01:41:33 +08:00
|
|
|
import { BaseController, Constants } from "@certd/lib-server";
|
|
|
|
|
import { Controller, Get, Inject, Param, Post, Provide } from "@midwayjs/core";
|
|
|
|
|
import { PipelineService } from "../../modules/pipeline/service/pipeline-service.js";
|
2026-01-09 01:10:43 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*/
|
|
|
|
|
@Provide()
|
2026-05-31 01:41:33 +08:00
|
|
|
@Controller("/api/webhook/")
|
2026-01-09 01:10:43 +08:00
|
|
|
export class WebhookController extends BaseController {
|
|
|
|
|
@Inject()
|
|
|
|
|
pipelineService: PipelineService;
|
|
|
|
|
|
2026-05-31 01:41:33 +08:00
|
|
|
@Get("/:webhookKey", { description: Constants.per.guest })
|
|
|
|
|
@Post("/:webhookKey", { description: Constants.per.guest })
|
|
|
|
|
async webhook(@Param("webhookKey") webhookKey: string): Promise<any> {
|
2026-01-09 01:10:43 +08:00
|
|
|
await this.pipelineService.triggerByWebhook(webhookKey);
|
|
|
|
|
return this.ok({});
|
|
|
|
|
}
|
|
|
|
|
}
|