@@ -1,10 +1,11 @@
|
||||
import { Controller, Get, Post, Param, UseGuards } from '@nestjs/common';
|
||||
import { ApiTags, ApiOperation, ApiBearerAuth, ApiResponse } from '@nestjs/swagger';
|
||||
import { Controller, Get, Post, Param, Body, Query, UseGuards } from '@nestjs/common';
|
||||
import { ApiTags, ApiOperation, ApiBearerAuth, ApiResponse, ApiQuery } from '@nestjs/swagger';
|
||||
import { JwtAuthGuard } from '../auth/guards/jwt-auth.guard';
|
||||
import { RolesGuard } from '../common/guards/roles.guard';
|
||||
import { Roles } from '../common/decorators/roles.decorator';
|
||||
import { VenueAccessGuard } from '../common/guards/venue-access.guard';
|
||||
import { RemindersService } from './reminders.service';
|
||||
import { SendRemindersDto } from './dto/send-reminders.dto';
|
||||
|
||||
@ApiTags('Reminders')
|
||||
@ApiBearerAuth()
|
||||
@@ -14,8 +15,8 @@ export class RemindersController {
|
||||
constructor(private service: RemindersService) {}
|
||||
|
||||
@Get('candidates')
|
||||
@ApiOperation({ summary: 'List tabs eligible for payment reminders' })
|
||||
@ApiResponse({ status: 200, description: 'List of eligible tabs with customer email and amount' })
|
||||
@ApiOperation({ summary: 'List customers with an unpaid tab and their reminder history' })
|
||||
@ApiResponse({ status: 200, description: 'Unpaid tabs with email, amount, reminder count and eligibility' })
|
||||
async listCandidates(@Param('venueId') venueId: string) {
|
||||
return this.service.listCandidates(venueId);
|
||||
}
|
||||
@@ -27,15 +28,16 @@ export class RemindersController {
|
||||
@ApiResponse({ status: 201, description: 'Reminders sent' })
|
||||
@ApiResponse({ status: 400, description: 'Resend not configured' })
|
||||
@ApiResponse({ status: 409, description: 'Reminders are already being sent' })
|
||||
async send(@Param('venueId') venueId: string) {
|
||||
return this.service.sendReminders(venueId);
|
||||
async send(@Param('venueId') venueId: string, @Body() dto: SendRemindersDto) {
|
||||
return this.service.sendReminders(venueId, dto.tabIds);
|
||||
}
|
||||
|
||||
@Get()
|
||||
@ApiOperation({ summary: 'Get reminder history' })
|
||||
@ApiQuery({ name: 'customerName', required: false, description: 'Only reminders sent to this customer' })
|
||||
@ApiResponse({ status: 200, description: 'List of previously sent reminders' })
|
||||
async history(@Param('venueId') venueId: string) {
|
||||
return this.service.history(venueId);
|
||||
async history(@Param('venueId') venueId: string, @Query('customerName') customerName?: string) {
|
||||
return this.service.history(venueId, customerName);
|
||||
}
|
||||
|
||||
@Post('test/:plannedTabId')
|
||||
|
||||
Reference in New Issue
Block a user