import { Controller, Post, Get, Body, Param, Query, UseGuards, Request } from '@nestjs/common'; import { ApiTags, ApiOperation, ApiBearerAuth } from '@nestjs/swagger'; import { NotificationsService } from './services/notifications.service'; import { SendNotificationDto, BulkNotificationDto } from './dto/notification.dto'; import { JwtAuthGuard } from 'src/common/guards/jwt-auth.guard'; @ApiTags('notifications') @Controller('notifications') @UseGuards(JwtAuthGuard) @ApiBearerAuth() export class NotificationsController { constructor(private readonly notificationsService: NotificationsService) {} @Post('send') @ApiOperation({ summary: 'Send a notification' }) async send(@Request() req, @Body() dto: SendNotificationDto) { return this.notificationsService.send(req.user.partnerId, dto); } @Post('bulk') @ApiOperation({ summary: 'Send bulk notifications' }) async sendBulk(@Request() req, @Body() dto: BulkNotificationDto) { return this.notificationsService.sendBulk(req.user.partnerId, dto); } @Get(':id/status') @ApiOperation({ summary: 'Get notification status' }) async getStatus(@Request() req, @Param('id') id: string) { return this.notificationsService.getStatus(id, req.user.partnerId); } @Get('batch/:batchId/status') @ApiOperation({ summary: 'Get batch notification status' }) async getBatchStatus(@Request() req, @Param('batchId') batchId: string) { return this.notificationsService.getBatchStatus(batchId, req.user.partnerId); } }