mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-28 16:00:56 +00:00
Card called GET /warehouse-inventory (staff perm) → 403 swallowed as
empty state. New customer-safe bookings/:id/location endpoint returns location fields only; card now uses it.
This commit is contained in:
@@ -556,6 +556,12 @@ export class WarehouseInventoryController {
|
||||
return this.inventoryService.bookingContainerWeights(bookingId);
|
||||
}
|
||||
|
||||
@Get('bookings/:bookingId/location')
|
||||
@ApiOperation({ summary: "Warehouse location of a booking's inventory (customer portal)" })
|
||||
bookingLocation(@Param('bookingId', ParseUUIDPipe) bookingId: string) {
|
||||
return this.inventoryService.bookingLocation(bookingId);
|
||||
}
|
||||
|
||||
@Post(':id/deliver')
|
||||
@BookingStaff(FREIGHT_PERMS.warehouseInventory.deliver)
|
||||
@ApiOperation({ summary: 'Deliver import goods to the customer + capture proof of delivery' })
|
||||
|
||||
@@ -1030,6 +1030,28 @@ export class WarehouseInventoryService {
|
||||
return this.findAll({ ...filter, status: 'READY_FOR_LOADING' });
|
||||
}
|
||||
|
||||
/**
|
||||
* Warehouse location rows for one booking, trimmed for the customer portal:
|
||||
* no staff guard on the route, so only location fields leave the API —
|
||||
* never notes, fees or inspection internals.
|
||||
*/
|
||||
async bookingLocation(bookingId: string) {
|
||||
const items = await this.inventoryRepository.findAll({
|
||||
where: { bookingId },
|
||||
relations: { warehouse: true, yard: true, zone: true },
|
||||
order: { createdAt: 'DESC' },
|
||||
});
|
||||
return items.map((i) => ({
|
||||
id: i.id,
|
||||
bookingId: i.bookingId,
|
||||
status: i.status,
|
||||
arrivedAt: i.arrivedAt ?? null,
|
||||
warehouse: i.warehouse ? { id: i.warehouse.id, name: i.warehouse.name, code: i.warehouse.code } : null,
|
||||
yard: i.yard ? { id: i.yard.id, name: i.yard.name, code: i.yard.code } : null,
|
||||
zone: i.zone ? { id: i.zone.id, name: i.zone.name, code: i.zone.code } : null,
|
||||
}));
|
||||
}
|
||||
|
||||
async findById(id: string): Promise<WarehouseInventory> {
|
||||
const item = await this.inventoryRepository.findById(id, {
|
||||
relations: { warehouse: { facility: true }, yard: true, zone: true },
|
||||
|
||||
Reference in New Issue
Block a user