import { Controller, Get, Patch, Param, UseGuards, Req } from '@nestjs/common'; import { ApiTags, ApiOperation, ApiBearerAuth } from '@nestjs/swagger'; import { NotificationsService } from './notifications.service'; import { JwtAuthGuard } from '../auth/jwt-auth.guard'; @ApiTags('In-App Notifications') @Controller('me/notifications') @UseGuards(JwtAuthGuard) @ApiBearerAuth() export class NotificationsController { constructor(private readonly notifService: NotificationsService) {} @Get() @ApiOperation({ summary: 'Paginated list of user notifications' }) getNotifications(@Req() req: any) { return this.notifService.getNotifications(req.user.userId); } @Patch('read-all') @ApiOperation({ summary: 'Mark all notifications as read' }) markAllAsRead(@Req() req: any) { return this.notifService.markAllAsRead(req.user.userId); } @Patch(':id/read') @ApiOperation({ summary: 'Mark single notification as read' }) markAsRead(@Req() req: any, @Param('id') id: string) { return this.notifService.markAsRead(req.user.userId, id); } }