import { Body, Controller, Get, Param, Post, Query } from '@nestjs/common'; import { z } from 'zod'; import { Reminder, ReminderCandidate, SendRemindersResult, sendRemindersSchema } from '@kooltap/shared'; import { zod } from '../common/zod.pipe'; import { Authorized, Roles } from '../common/auth'; import { RemindersService } from './reminders.service'; @Controller('venues/:venueId/reminders') @Authorized() export class RemindersController { constructor(private reminders: RemindersService) {} @Get('candidates') candidates(@Param('venueId') venueId: string): Promise<{ candidates: ReminderCandidate[]; cooldownDays: number }> { return this.reminders.candidates(venueId); } @Post('send') @Roles('admin', 'manager') send(@Param('venueId') venueId: string, @Body(zod(sendRemindersSchema)) dto: z.output): Promise { return this.reminders.send(venueId, dto.tabIds); } @Get() history(@Param('venueId') venueId: string, @Query('customerName') customerName?: string): Promise { return this.reminders.history(venueId, customerName); } }