All files / visitor visitor.controller.ts

0% Statements 0/31
0% Branches 0/4
0% Functions 0/13
0% Lines 0/29

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 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81                                                                                                                                                                 
import { Controller, Get, Post, Put, Body, Param, Query, UseGuards } from '@nestjs/common';
import { VisitorService } from './visitor.service';
import { JwtAuthGuard } from '../../platform/auth/jwt-auth.guard';
 
@Controller('api/v1/visitor')
@UseGuards(JwtAuthGuard)
export class VisitorController {
  constructor(private readonly visitorService: VisitorService) {}
 
  @Get('config')
  async getConfiguration(@Query('tenantId') tenantId: string) {
    return this.visitorService.getConfiguration(tenantId);
  }
 
  @Post('profiles')
  async createProfile(@Query('tenantId') tenantId: string, @Body() body: any) {
    return this.visitorService.createProfile(tenantId, body);
  }
 
  @Post('appointments')
  async createAppointment(@Query('tenantId') tenantId: string, @Body() body: any) {
    return this.visitorService.createAppointment(tenantId, body);
  }
 
  @Put('appointments/:id/approve')
  async approveAppointment(@Param('id') id: string, @Query('tenantId') tenantId: string) {
    return this.visitorService.approveAppointment(tenantId, id);
  }
 
  @Post('checkin')
  async checkIn(
    @Query('tenantId') tenantId: string,
    @Body('visitorProfileId') profileId: string,
    @Body('appointmentId') appointmentId?: string,
    @Body('ndaStorageKey') ndaStorageKey?: string
  ) {
    return this.visitorService.checkInVisitor(tenantId, profileId, appointmentId, ndaStorageKey);
  }
 
  @Post('checkout/:id')
  async checkOut(@Param('id') checkInId: string, @Query('tenantId') tenantId: string) {
    return this.visitorService.checkOutVisitor(tenantId, checkInId);
  }
 
  @Post('gatepasses')
  async createGatePass(@Query('tenantId') tenantId: string, @Body() body: any) {
    return this.visitorService.createGatePass(tenantId, body);
  }
 
  @Post('parking/slots')
  async createParkingSlot(@Query('tenantId') tenantId: string, @Body() body: any) {
    return this.visitorService.createParkingSlot(tenantId, body);
  }
 
  @Post('parking/reserve')
  async reserveParking(
    @Query('tenantId') tenantId: string,
    @Body('reservationDate') reservationDate: string,
    @Body('vehicleType') vehicleType: string,
    @Body('vehicleRegistrationNumber') registrationNumber: string,
    @Body('visitorProfileId') profileId?: string
  ) {
    return this.visitorService.reserveParking(tenantId, reservationDate, vehicleType, registrationNumber, profileId);
  }
 
  @Post('facilities/locations')
  async createLocation(@Query('tenantId') tenantId: string, @Body() body: any) {
    return this.visitorService.createLocation(tenantId, body);
  }
 
  @Post('facilities/rooms')
  async createRoom(@Query('tenantId') tenantId: string, @Body() body: any) {
    return this.visitorService.createFacilityRoom(tenantId, body);
  }
 
  @Get('analytics')
  async getAnalytics(@Query('tenantId') tenantId: string) {
    return this.visitorService.getAnalyticsMetrics(tenantId);
  }
}