prevision / apps /prevision-api /src /webhooks /webhooks.controller.ts
github-actions[bot]
Automated Deploy: 23110475c742a5d4f03930b55bca09042215c1dd
1fe7075
Raw History Blame Contribute Delete
633 Bytes
import { Controller, HttpCode, Post, UseGuards } from '@nestjs/common';
import type Stripe from 'stripe';
import { StripeEvent } from './stripe-event.decorator.js';
import { StripeWebhookGuard } from './stripe-webhook.guard.js';
import { WebhooksService } from './webhooks.service.js';
@Controller('webhooks')
export class WebhooksController {
constructor(private readonly webhooks: WebhooksService) {}
@Post('stripe')
@HttpCode(200)
@UseGuards(StripeWebhookGuard)
async stripe(@StripeEvent() event: Stripe.Event): Promise<{ received: true }> {
await this.webhooks.handle(event);
return { received: true };
}
}