enhance contract clearance and train scheduling logic; add filters for clearance documents and improve booking validation

This commit is contained in:
Marshal
2026-07-13 21:40:10 +00:00
parent 3fe4ea72ac
commit 957a185a4d
5 changed files with 45 additions and 7 deletions

View File

@@ -848,8 +848,10 @@ export class ContractClearanceService {
}
/**
* GL ET clearance hub: every customs (Path B) contract in phased clearance,
* including after booking is created.
* GL ET clearance hub, Contracts tab: ONE_TIME customs (Path B) contracts in
* phased clearance that already carry at least one uploaded clearance
* document — a contract still waiting for its first document has nothing to
* review, and GENERAL contracts clear per booking, not at contract level.
*/
async queue(filter: FilterContractDto): Promise<PaginatedContracts> {
return this.contractsRepository.findAllPaginated({
@@ -857,6 +859,8 @@ export class ContractClearanceService {
pageSize: filter.pageSize ?? 100,
statuses: [...PHASED_CUSTOMS_CONTRACT_QUEUE_STATUSES],
customsClearingEnabled: true,
contractKind: 'ONE_TIME',
hasClearanceDocuments: true,
sortBy: filter.sortBy,
sortOrder: filter.sortOrder,
});