mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-27 00:52:50 +00:00
- Introduced StampUpload component for uploading company stamp images. - Integrated stamp upload in contract signing modal, supporting PNG and JPG formats. - Implemented validation for file type and size (max 5 MB). - Added visual feedback for drag-and-drop functionality. - Updated contract-related pages to handle duplicate contract alerts and pricing notices. - Enhanced contract expiry management with a nightly sweep service. - Added unit tests for new features and updated existing tests for contract handling.
26 lines
897 B
TypeScript
26 lines
897 B
TypeScript
import type { Contract } from '../entities/contract.entity';
|
|
|
|
/** Statuses that already mean "done/void" — a contract in one of these never blocks a duplicate. */
|
|
export const TERMINAL_CONTRACT_STATUSES = [
|
|
'REJECTED',
|
|
'CANCELLED',
|
|
'CONTRACT_CLOSED',
|
|
'ARCHIVED',
|
|
'EXPIRED',
|
|
] as const;
|
|
|
|
/**
|
|
* True once a contract is done, either explicitly (terminal status) or by date
|
|
* (past contractValidUntil). Checked by date too because the nightly expiry
|
|
* cron only flips the status once a day — this keeps same-day checks correct
|
|
* even a few hours before the cron runs.
|
|
*/
|
|
export function isEffectivelyExpired(
|
|
contract: Pick<Contract, 'status' | 'contractValidUntil'>,
|
|
): boolean {
|
|
if ((TERMINAL_CONTRACT_STATUSES as readonly string[]).includes(contract.status)) {
|
|
return true;
|
|
}
|
|
return Boolean(contract.contractValidUntil && contract.contractValidUntil < new Date());
|
|
}
|