mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-27 12:00:59 +00:00
add clearance history and operations history endpoints, update UI components for history view
This commit is contained in:
@@ -506,4 +506,28 @@ export class ContractClearanceService {
|
||||
sortOrder: filter.sortOrder,
|
||||
});
|
||||
}
|
||||
|
||||
/** GL ET history: contracts that completed Path B clearance. */
|
||||
async history(filter: FilterContractDto): Promise<PaginatedContracts> {
|
||||
return this.contractsRepository.findAllPaginated({
|
||||
page: filter.page ?? 1,
|
||||
pageSize: filter.pageSize ?? 50,
|
||||
statuses: ['CLEARANCE_READY_FOR_BOOKING', 'ACTIVE', 'CLOSED', 'CANCELLED'],
|
||||
customsClearingEnabled: true,
|
||||
sortBy: filter.sortBy ?? 'createdAt',
|
||||
sortOrder: filter.sortOrder ?? 'DESC',
|
||||
});
|
||||
}
|
||||
|
||||
/** Operations history: contracts that completed Path A self-clearance review. */
|
||||
async opsHistory(filter: FilterContractDto): Promise<PaginatedContracts> {
|
||||
return this.contractsRepository.findAllPaginated({
|
||||
page: filter.page ?? 1,
|
||||
pageSize: filter.pageSize ?? 50,
|
||||
statuses: ['CLEARANCE_READY_FOR_BOOKING', 'ACTIVE', 'CLOSED', 'CANCELLED'],
|
||||
customsClearingEnabled: false,
|
||||
sortBy: filter.sortBy ?? 'createdAt',
|
||||
sortOrder: filter.sortOrder ?? 'DESC',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -459,6 +459,20 @@ export class ContractsController {
|
||||
return this.clearanceService.opsFinalize(id);
|
||||
}
|
||||
|
||||
@Get('clearance/history')
|
||||
@BookingStaff(FREIGHT_PERMS.contracts.finalizeClearance)
|
||||
@ApiOperation({ summary: 'GL ET clearance history: contracts that completed Path B clearance' })
|
||||
clearanceHistory(@Query() filter: FilterContractDto) {
|
||||
return this.clearanceService.history(filter);
|
||||
}
|
||||
|
||||
@Get('clearance/ops-history')
|
||||
@BookingStaff(FREIGHT_PERMS.contracts.opsClearanceReview)
|
||||
@ApiOperation({ summary: 'Operations clearance history: contracts that completed Path A self-clearance' })
|
||||
opsClearanceHistory(@Query() filter: FilterContractDto) {
|
||||
return this.clearanceService.opsHistory(filter);
|
||||
}
|
||||
|
||||
// ── Booking under contract (Path A customer / Path B GL ET) ────────────────
|
||||
|
||||
@Post(':id/bookings')
|
||||
|
||||
Reference in New Issue
Block a user