mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-07 16:35:42 +00:00
feat: add contract extension request functionality
- Implemented method in to allow customers to request an extension for expired contracts. - Added component in for users to initiate extension requests. - Updated to include logic for handling extension requests for expired contracts. - Enhanced to display extension request options and status. - Created migration to add and columns to the contracts table. - Added unit tests for contract extension request and handling in . - Defined DTOs for request and extension in . - Updated types in to include new fields related to contract extensions.
This commit is contained in:
@@ -135,7 +135,9 @@ export class ContractsRepository extends BaseRepository<Contract> {
|
||||
const result = await this.repository
|
||||
.createQueryBuilder()
|
||||
.update(Contract)
|
||||
.set({ status: 'EXPIRED' })
|
||||
// SET reads the pre-update row, so status_before_expiry gets the status
|
||||
// being replaced — the value ContractTransitionService.extend restores.
|
||||
.set({ status: 'EXPIRED', statusBeforeExpiry: () => 'status' })
|
||||
.where('deleted_at IS NULL')
|
||||
.andWhere('status NOT IN (:...terminal)', { terminal: TERMINAL_CONTRACT_STATUSES })
|
||||
.andWhere('contract_valid_until IS NOT NULL AND contract_valid_until < :now', {
|
||||
@@ -155,7 +157,7 @@ export class ContractsRepository extends BaseRepository<Contract> {
|
||||
const result = await this.repository
|
||||
.createQueryBuilder()
|
||||
.update(Contract)
|
||||
.set({ status: 'EXPIRED' })
|
||||
.set({ status: 'EXPIRED', statusBeforeExpiry: () => 'status' })
|
||||
.where('id = :id', { id })
|
||||
.andWhere('deleted_at IS NULL')
|
||||
.andWhere('status NOT IN (:...terminal)', { terminal: TERMINAL_CONTRACT_STATUSES })
|
||||
|
||||
Reference in New Issue
Block a user