All files / src/platform/calendar public-booking.controller.ts

0% Statements 0/10
0% Branches 0/6
0% Functions 0/2
0% Lines 0/8

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22                                           
import { Controller, Get, Post, Body, Req } from '@nestjs/common';
import { ApiTags, ApiOperation } from '@nestjs/swagger';
import { BookingEngine } from './booking-engine.service';
 
@ApiTags('Public Booking')
@Controller('api/v1/public/booking')
export class PublicBookingController {
  constructor(private readonly bookingEngine: BookingEngine) {}
 
  @Post('request')
  @ApiOperation({ summary: 'Submit a public booking request (requires rate limiting)' })
  async requestPublicBooking(@Req() req: any, @Body() body: any) {
    const tenantId = req.headers['x-tenant-id'] || 'default-tenant';
    return this.bookingEngine.createBooking(tenantId, {
      ...body,
      startAt: new Date(body.startAt),
      endAt: new Date(body.endAt),
      bookerId: 'external_public_user'
    });
  }
}