mirror of
https://github.com/certd/certd.git
synced 2026-04-19 09:00:53 +08:00
20 lines
670 B
TypeScript
20 lines
670 B
TypeScript
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';
|
|
|
|
/**
|
|
*/
|
|
@Provide()
|
|
@Controller('/api/webhook/')
|
|
export class WebhookController extends BaseController {
|
|
@Inject()
|
|
pipelineService: PipelineService;
|
|
|
|
@Get('/:webhookKey', { description: Constants.per.guest })
|
|
@Post('/:webhookKey', { description: Constants.per.guest })
|
|
async webhook(@Param('webhookKey') webhookKey: string): Promise<any> {
|
|
await this.pipelineService.triggerByWebhook(webhookKey);
|
|
return this.ok({});
|
|
}
|
|
}
|