mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-05 21:13:37 +00:00
75 lines
2.0 KiB
TypeScript
75 lines
2.0 KiB
TypeScript
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
import { IsOptional, IsString, IsUUID, MinLength } from 'class-validator';
|
|
|
|
export class ApproveStepDto {
|
|
@ApiProperty({ description: 'LINE_STAFF | DIRECTOR | CEO' })
|
|
@IsString()
|
|
requiredRole!: string;
|
|
}
|
|
|
|
export class RequestChangesDto {
|
|
@ApiProperty({ description: 'Note explaining what the customer must fix' })
|
|
@IsString()
|
|
@MinLength(1)
|
|
note!: string;
|
|
}
|
|
|
|
export class RejectContractDto {
|
|
@ApiProperty()
|
|
@IsString()
|
|
@MinLength(1)
|
|
reason!: string;
|
|
}
|
|
|
|
export class RejectStepDto {
|
|
@ApiProperty()
|
|
@IsString()
|
|
@MinLength(1)
|
|
reason!: string;
|
|
|
|
/**
|
|
* Where the rejection lands. Omitted → the customer: the contract goes to
|
|
* REJECTED and the customer must resubmit (unchanged legacy behaviour, and
|
|
* the only option for the first approver in the chain). Set to an EARLIER
|
|
* approved step's id → send-back: that step and everything after it reset to
|
|
* PENDING and the chain re-runs from there; the contract never leaves
|
|
* PENDING_APPROVAL and the customer is not involved.
|
|
*/
|
|
@ApiPropertyOptional({
|
|
description:
|
|
'Id of an earlier approval step to send the contract back to. Omit to reject to the customer.',
|
|
})
|
|
@IsOptional()
|
|
@IsUUID()
|
|
returnToStepId?: string;
|
|
}
|
|
|
|
export class CancelContractDto {
|
|
@ApiPropertyOptional()
|
|
@IsOptional()
|
|
@IsString()
|
|
reason?: string;
|
|
}
|
|
|
|
/** Staff cancel is terminal, so the reason is mandatory — it is the audit record. */
|
|
export class CancelContractByStaffDto {
|
|
@ApiProperty({ description: 'Why the contract is being cancelled — shown to the customer' })
|
|
@IsString()
|
|
@MinLength(1)
|
|
reason!: string;
|
|
}
|
|
|
|
export class SuspendContractDto {
|
|
@ApiProperty({ description: 'Why the contract is being frozen — shown to the customer' })
|
|
@IsString()
|
|
@MinLength(1)
|
|
reason!: string;
|
|
}
|
|
|
|
export class ResumeContractDto {
|
|
@ApiPropertyOptional({ description: 'Optional note recorded when the suspension is lifted' })
|
|
@IsOptional()
|
|
@IsString()
|
|
note?: string;
|
|
}
|