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 | import { Controller, Get, Post, Put, Body, Param, Query, UseGuards } from '@nestjs/common'; import { LogisticsService } from './logistics.service'; import { JwtAuthGuard } from '../../platform/auth/jwt-auth.guard'; @Controller('api/v1/logistics') @UseGuards(JwtAuthGuard) export class LogisticsController { constructor(private readonly logisticsService: LogisticsService) {} @Get('configuration') async getConfiguration(@Query('tenantId') tenantId: string) { return this.logisticsService.getConfiguration(tenantId); } @Post('shipments') async createShipment(@Query('tenantId') tenantId: string, @Body() body: any) { return this.logisticsService.createShipment(tenantId, body); } @Put('shipments/:id/dispatch') async dispatchShipment(@Param('id') shipmentId: string, @Query('tenantId') tenantId: string) { return this.logisticsService.dispatchShipment(tenantId, shipmentId); } @Post('trips') async createTrip(@Query('tenantId') tenantId: string, @Body() body: any) { return this.logisticsService.createTrip(tenantId, body); } @Put('trips/:id/start') async startTrip(@Param('id') tripId: string, @Query('tenantId') tenantId: string) { return this.logisticsService.startTrip(tenantId, tripId); } @Post('trips/:id/cost') async calculateCost( @Param('id') tripId: string, @Query('tenantId') tenantId: string, @Body() body: any ) { const cost = await this.logisticsService.calculateTripFreightCost(tenantId, tripId, body.distanceKm); return { freightCostMinor: cost }; } @Post('tracking/ping') async recordPing(@Query('tenantId') tenantId: string, @Body() body: any) { return this.logisticsService.recordLocationPing(tenantId, body); } @Post('deliveries/pod') async submitPod(@Query('tenantId') tenantId: string, @Body() body: any) { return this.logisticsService.submitProofOfDelivery(tenantId, body); } @Put('deliveries/pod/:id/correct') async correctPod( @Param('id') podId: string, @Query('tenantId') tenantId: string, @Body() body: any ) { return this.logisticsService.correctProofOfDelivery(tenantId, podId, body); } } |