feat(backend): Webhooks mit HMAC-signierter Auslieferung (Modul 28)
WebhooksModule (WebhookSubscription: URL, Events, Secret, aktiv) mit Event-Dispatcher, angehaengt an 10 Ereignisse in 8 bestehenden Services (colony.created, inspection.created, queen.created, queen.replaced, harvest.created, batch.created, batch.updated, product.stock_changed, task.created, task.completed). Auslieferung ist best-effort und blockiert die ausloesende Anfrage nicht bei Fehlern.
This commit is contained in:
1 parent
8856d7d0f5
commit
59fdc816a0
26 files changed
+590
-8
No files matched your search
@@ -0,0 +1,34 @@
|
||||
import { Body, Controller, Delete, Get, Param, Post } from '@nestjs/common';
|
||||
import { ApiBearerAuth, ApiTags } from '@nestjs/swagger';
|
||||
import { Role } from '../../generated/prisma';
|
||||
import { Roles } from '../auth/decorators/roles.decorator';
|
||||
import { CurrentUser } from '../auth/decorators/current-user.decorator';
|
||||
import type { AuthenticatedUser } from '../auth/types/authenticated-user';
|
||||
import { CreateWebhookDto } from './dto/create-webhook.dto';
|
||||
import { WebhooksService } from './webhooks.service';
|
||||
|
||||
@ApiTags('webhooks')
|
||||
@ApiBearerAuth()
|
||||
@Roles(Role.ADMIN)
|
||||
@Controller('webhooks')
|
||||
export class WebhooksController {
|
||||
constructor(private readonly webhooksService: WebhooksService) {}
|
||||
|
||||
@Get()
|
||||
findAll() {
|
||||
return this.webhooksService.findAll();
|
||||
}
|
||||
|
||||
@Post()
|
||||
create(
|
||||
@Body() dto: CreateWebhookDto,
|
||||
@CurrentUser() actor: AuthenticatedUser,
|
||||
) {
|
||||
return this.webhooksService.create(dto, actor.id);
|
||||
}
|
||||
|
||||
@Delete(':id')
|
||||
delete(@Param('id') id: string, @CurrentUser() actor: AuthenticatedUser) {
|
||||
return this.webhooksService.delete(id, actor.id);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user