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 | import { Controller, Get, Post, Put, Body, Param, Req, UseGuards, Query } from '@nestjs/common'; import { FieldServiceService } from '../services/field-service.service'; import { HelpdeskTicketService } from '../services/helpdesk-ticket.service'; import { JwtAuthGuard } from '../../../platform/auth/jwt-auth.guard'; import { ApiTags, ApiOperation } from '@nestjs/swagger'; @ApiTags('MobileHelpdesk') @Controller('api/v1/mobile/helpdesk') @UseGuards(JwtAuthGuard) export class MobileHelpdeskController { constructor( private readonly fsmSvc: FieldServiceService, private readonly ticketSvc: HelpdeskTicketService ) {} @Post('work-orders') @ApiOperation({ summary: 'Create service work order for technicians dispatch' }) async createWorkOrder(@Req() req: any, @Body() body: any) { const tenantId = req.user?.tenantId || 'SYSTEM'; return this.fsmSvc.createWorkOrder(tenantId, body.ticketId, body.workOrderType, body.priority, body.estimatedCostMinor); } @Post('work-orders/:id/schedule') @ApiOperation({ summary: 'Assign technician and schedule field visit' }) async scheduleVisit(@Req() req: any, @Param('id') id: string, @Body() body: any) { const tenantId = req.user?.tenantId || 'SYSTEM'; return this.fsmSvc.scheduleVisit(tenantId, id, body.technicianId, new Date(body.scheduledStart)); } @Post('visits/:id/check-in') @ApiOperation({ summary: 'GPS Check-in validation when technician arrives on geofence location' }) async checkIn(@Req() req: any, @Param('id') id: string, @Body() body: { latitude: number; longitude: number }) { const tenantId = req.user?.tenantId || 'SYSTEM'; return this.fsmSvc.technicianCheckIn(tenantId, id, body.latitude, body.longitude); } @Post('visits/:id/complete') @ApiOperation({ summary: 'Complete visit with customer validation OTP' }) async completeVisit(@Req() req: any, @Param('id') id: string, @Body() body: { notes: string; customerOtp: string }) { const tenantId = req.user?.tenantId || 'SYSTEM'; return this.fsmSvc.completeVisit(tenantId, id, body.notes, body.customerOtp); } @Post('work-orders/:id/parts-reservation') @ApiOperation({ summary: 'Request material parts check and ATP reservation' }) async reserveParts(@Req() req: any, @Param('id') id: string, @Body() body: { parts: Array<{ itemCode: string; qty: number }> }) { const tenantId = req.user?.tenantId || 'SYSTEM'; return this.fsmSvc.reservePartsForWorkOrder(tenantId, id, body.parts); } } |