Spaces:
Running
Running
| import { Controller, Get, Patch, Post, Param, Body, UseGuards, Request } from "@nestjs/common"; | |
| import { NotificationsService } from "./notifications.service"; | |
| import { JwtAuthGuard } from "../auth/guards/jwt-auth.guard"; | |
| import { RegisterPushTokenDto } from "./dto/register-push-token.dto"; | |
| ("notifications") | |
| (JwtAuthGuard) | |
| export class NotificationsController { | |
| constructor(private readonly notificationsService: NotificationsService) {} | |
| () | |
| async getUserNotifications(() req: any) { | |
| return this.notificationsService.getNotificationHistory(req.user.id); | |
| } | |
| ("register") | |
| async registerPushToken(() req: any, () dto: RegisterPushTokenDto) { | |
| return this.notificationsService.registerPushToken(req.user.id, dto.token); | |
| } | |
| (":id/read") | |
| async markAsRead(("id") id: string, () req: any) { | |
| return this.notificationsService.markAsRead(id, req.user.id); | |
| } | |
| } | |