mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-27 00:52:50 +00:00
Apply JwtGuard + FreightPermissionGuard (via @BookingStaff) to 83 staff endpoints across the 8 warehouse controllers, using existing edr_freight_app:warehouse* permissions: warehouses/yards/zones, inventory receive/move/load/unload/dispatch/gate-pass/release/deliver/inspect (incl. import & export queues), allocation + fee rules (demurrage/storage/ double-handling), accrual dashboard + acknowledge, and fee invoices. Customer-portal endpoints (booking-scoped documents, approve-delivery, portal fee-invoice view/document/receipt/pay-online) are intentionally left unguarded — they need a customer-ownership guard, not staff permissions. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
57 lines
2.0 KiB
TypeScript
57 lines
2.0 KiB
TypeScript
import { Body, Controller, Get, Param, ParseUUIDPipe, Patch, Post } from '@nestjs/common';
|
|
import { ApiBearerAuth, ApiOperation, ApiTags } from '@nestjs/swagger';
|
|
|
|
import { BookingStaff } from '../../common/booking-guards';
|
|
import { FREIGHT_PERMS } from '../../seed/freight-permissions.registry';
|
|
import { CreateWarehouseZoneDto } from './dto/create-warehouse-zone.dto';
|
|
import { UpdateWarehouseYardDto } from './dto/update-warehouse-yard.dto';
|
|
import { WarehouseYardsService } from './warehouse-yards.service';
|
|
import { WarehouseZonesService } from './warehouse-zones.service';
|
|
|
|
@ApiTags('warehouse-yards')
|
|
@ApiBearerAuth()
|
|
@Controller('warehouse-yards')
|
|
@BookingStaff(FREIGHT_PERMS.warehouseYards.view)
|
|
export class WarehouseYardsController {
|
|
constructor(
|
|
private readonly yardsService: WarehouseYardsService,
|
|
private readonly zonesService: WarehouseZonesService,
|
|
) {}
|
|
|
|
@Get()
|
|
@ApiOperation({ summary: 'List all warehouse yards' })
|
|
findAll() {
|
|
return this.yardsService.findAll();
|
|
}
|
|
|
|
@Get(':id')
|
|
@ApiOperation({ summary: 'Get warehouse yard by ID' })
|
|
findOne(@Param('id', ParseUUIDPipe) id: string) {
|
|
return this.yardsService.findById(id);
|
|
}
|
|
|
|
@Patch(':id')
|
|
@BookingStaff(FREIGHT_PERMS.warehouseYards.update)
|
|
@ApiOperation({ summary: 'Update warehouse yard' })
|
|
update(@Param('id', ParseUUIDPipe) id: string, @Body() dto: UpdateWarehouseYardDto) {
|
|
return this.yardsService.update(id, dto);
|
|
}
|
|
|
|
@Get(':yardId/zones')
|
|
@BookingStaff(FREIGHT_PERMS.warehouseZones.view)
|
|
@ApiOperation({ summary: 'List zones within a yard' })
|
|
listZones(@Param('yardId', ParseUUIDPipe) yardId: string) {
|
|
return this.zonesService.findByYard(yardId);
|
|
}
|
|
|
|
@Post(':yardId/zones')
|
|
@BookingStaff(FREIGHT_PERMS.warehouseZones.create)
|
|
@ApiOperation({ summary: 'Create a zone within a yard' })
|
|
createZone(
|
|
@Param('yardId', ParseUUIDPipe) yardId: string,
|
|
@Body() dto: CreateWarehouseZoneDto,
|
|
) {
|
|
return this.zonesService.create(yardId, dto);
|
|
}
|
|
}
|