import { Controller, Get, Patch, Param, UseGuards, Request } from '@nestjs/common'; import { AuthGuard } from '@nestjs/passport'; import { NotificationsService } from './notifications.service'; @UseGuards(AuthGuard('jwt')) @Controller('notifications') export class NotificationsController { constructor(private readonly notificationsService: NotificationsService) {} @Get('my') findMine(@Request() req: any) { return this.notificationsService.findMyNotifications(req.user.userId); } @Get('unread-count') unreadCount(@Request() req: any) { return this.notificationsService.getUnreadCount(req.user.userId).then(count => ({ count })); } @Patch('mark-all-read') markAllRead(@Request() req: any) { return this.notificationsService.markAllRead(req.user.userId); } @Patch(':id/read') markOneRead(@Param('id') id: string) { return this.notificationsService.markOneRead(id); } }