mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-09 01:18:18 +00:00
add dispute functionality for contract duty and implement collection dates
This commit is contained in:
@@ -164,7 +164,9 @@ export class ContractsRepository extends BaseRepository<Contract> {
|
||||
'contract.files',
|
||||
FileRecord,
|
||||
'file',
|
||||
"file.resource_id = contract.id AND file.resource = 'contracts'",
|
||||
// Superseded versions are soft-deleted, not dropped — keep them out of
|
||||
// the live file list (a manual join condition is not filtered for us).
|
||||
"file.resource_id = contract.id AND file.resource = 'contracts' AND file.deleted_at IS NULL",
|
||||
)
|
||||
.getOne();
|
||||
|
||||
@@ -558,6 +560,17 @@ export class ContractsRepository extends BaseRepository<Contract> {
|
||||
);
|
||||
}
|
||||
|
||||
/** Review notes of one type, newest first — the duty advice/dispute rounds. */
|
||||
async findReviewNotes(
|
||||
contractId: string,
|
||||
noteType: ContractReviewNoteType,
|
||||
): Promise<ContractReviewNote[]> {
|
||||
return this.dataSource.getRepository(ContractReviewNote).find({
|
||||
where: { contractId, noteType },
|
||||
order: { createdAt: 'DESC' },
|
||||
});
|
||||
}
|
||||
|
||||
async findLatestReviewNote(
|
||||
contractId: string,
|
||||
noteType?: ContractReviewNoteType,
|
||||
@@ -725,12 +738,20 @@ export class ContractsRepository extends BaseRepository<Contract> {
|
||||
ContractClearanceCycle,
|
||||
| 'dutyRequired'
|
||||
| 'vesselDepartureDate'
|
||||
| 'vesselArrivalDate'
|
||||
| 'doCollectedDate'
|
||||
| 'roAmendmentRequestedAt'
|
||||
| 'roHoldReason'
|
||||
| 'currentPhase'
|
||||
| 'status'
|
||||
| 'preClearanceFinalizedAt'
|
||||
| 'completedAt'
|
||||
| 'transitAssigneeRequestedAt'
|
||||
| 'transitAssigneeRequestedByUserId'
|
||||
| 'transitAssigneeRequestNote'
|
||||
| 'transitAssigneeName'
|
||||
| 'transitAssigneeAssignedAt'
|
||||
| 'transitAssigneeAssignedByUserId'
|
||||
>
|
||||
>,
|
||||
): Promise<void> {
|
||||
|
||||
Reference in New Issue
Block a user