| 21 | @Controller('webhooks/configurations') |
| 22 | @UseGuards(AuthGuard) |
| 23 | export class WebhooksAdminController { |
| 24 | constructor(private readonly webhooksService: WebhooksService) {} |
| 25 | |
| 26 | @Get() |
| 27 | @ApiOperation({ summary: 'List all webhook configurations' }) |
| 28 | @ApiOkResponse({ type: [WebhookConfigurationResponseDto] }) |
| 29 | async list(@CurrentAuth() auth: AuthContext) { |
| 30 | return this.webhooksService.list(auth); |
| 31 | } |
| 32 | |
| 33 | @Get(':id') |
| 34 | @ApiOperation({ summary: 'Get a webhook configuration by ID' }) |
| 35 | @ApiOkResponse({ type: WebhookConfigurationResponseDto }) |
| 36 | async get(@CurrentAuth() auth: AuthContext, @Param('id') id: string) { |
| 37 | return this.webhooksService.get(auth, id); |
| 38 | } |
| 39 | |
| 40 | @Post() |
| 41 | @ApiOperation({ summary: 'Create a new webhook configuration' }) |
| 42 | @ApiOkResponse({ type: WebhookConfigurationResponseDto }) |
| 43 | async create( |
| 44 | @CurrentAuth() auth: AuthContext, |
| 45 | @Body(new ZodValidationPipe(CreateWebhookRequestDto.schema)) dto: CreateWebhookRequestDto, |
| 46 | ) { |
| 47 | return this.webhooksService.create(auth, dto); |
| 48 | } |
| 49 | |
| 50 | @Put(':id') |
| 51 | @ApiOperation({ summary: 'Update a webhook configuration' }) |
| 52 | @ApiOkResponse({ type: WebhookConfigurationResponseDto }) |
| 53 | async update( |
| 54 | @CurrentAuth() auth: AuthContext, |
| 55 | @Param('id') id: string, |
| 56 | @Body(new ZodValidationPipe(UpdateWebhookRequestDto.schema)) dto: UpdateWebhookRequestDto, |
| 57 | ) { |
| 58 | return this.webhooksService.update(auth, id, dto); |
| 59 | } |
| 60 | |
| 61 | @Delete(':id') |
| 62 | @ApiOperation({ summary: 'Delete a webhook configuration' }) |
| 63 | async delete(@CurrentAuth() auth: AuthContext, @Param('id') id: string) { |
| 64 | await this.webhooksService.delete(auth, id); |
| 65 | return { success: true }; |
| 66 | } |
| 67 | |
| 68 | @Post(':id/regenerate-path') |
| 69 | @ApiOperation({ summary: 'Regenerate webhook path (creates new URL)' }) |
| 70 | @ApiOkResponse({ type: RegeneratePathResponseDto }) |
| 71 | async regeneratePath(@CurrentAuth() auth: AuthContext, @Param('id') id: string) { |
| 72 | return this.webhooksService.regeneratePath(auth, id); |
| 73 | } |
| 74 | |
| 75 | @Get(':id/url') |
| 76 | @ApiOperation({ summary: 'Get the webhook URL for a configuration' }) |
| 77 | @ApiOkResponse({ type: GetWebhookUrlResponseDto }) |
| 78 | async getUrl(@CurrentAuth() auth: AuthContext, @Param('id') id: string) { |
| 79 | return this.webhooksService.getUrl(auth, id); |
| 80 | } |
nothing calls this directly
no outgoing calls
no test coverage detected