import { Body, Controller, Post } from "@nestjs/common"; import { PushTokenService } from "./push-token.service.js"; import { PushNotificationService } from "./push-notification.service.js"; interface RegisterBody { userId: string; token: string; platform: string; } interface SendTestBody { userId: string; title: string; body: string; } @Controller("push") export class PushController { constructor( private readonly pushToken: PushTokenService, private readonly pushNotification: PushNotificationService, ) {} @Post("register") async register(@Body() body: RegisterBody) { return this.pushToken.register(body.userId, body.token, body.platform); } @Post("send-test") async sendTest(@Body() body: SendTestBody) { return this.pushNotification.sendToUser(body.userId, body.title, body.body); } }