mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-28 11:21:18 +00:00
feat(contracts): lazily expire lapsed contracts and price fuel surcharge
This commit is contained in:
@@ -811,6 +811,16 @@ export class ContractsService {
|
||||
throw new NotFoundException(`Contract ${id} not found`);
|
||||
}
|
||||
|
||||
// Lazy expiry flip: the nightly cron only sweeps once a day, so a
|
||||
// contract can be past contract_valid_until for hours before it shows
|
||||
// EXPIRED. Flip it here so the detail page never shows a stale status.
|
||||
if (isEffectivelyExpired(contract) && contract.status !== 'EXPIRED') {
|
||||
const flipped = await this.contractsRepository.expireIfLapsed(id);
|
||||
if (flipped) {
|
||||
contract.status = 'EXPIRED';
|
||||
}
|
||||
}
|
||||
|
||||
if (contract.files && contract.files.length > 0) {
|
||||
contract.files = await Promise.all(
|
||||
contract.files.map(async (file: FileRecord) => {
|
||||
|
||||
Reference in New Issue
Block a user