mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-07 16:35:42 +00:00
55 lines
1.5 KiB
TypeScript
55 lines
1.5 KiB
TypeScript
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
import { Type } from 'class-transformer';
|
|
import {
|
|
IsDateString,
|
|
IsInt,
|
|
IsOptional,
|
|
Max,
|
|
Min,
|
|
ValidateNested,
|
|
} from 'class-validator';
|
|
|
|
import { UpdateContractDocumentDto } from './contract-document.dto';
|
|
|
|
export class AcceptContractDto {
|
|
@ApiProperty({
|
|
description:
|
|
'How many days the contract stays valid, counted from the accept date. ' +
|
|
'The contract is valid from now through now + validityDays.',
|
|
minimum: 1,
|
|
maximum: 3650,
|
|
example: 365,
|
|
})
|
|
@IsInt()
|
|
@Min(1)
|
|
@Max(3650)
|
|
validityDays!: number;
|
|
|
|
/**
|
|
* Explicit validity window picked by staff in the accept dialog. When both are
|
|
* present they win over `validityDays` (which is then only the derived span)
|
|
* and the configured-period check is skipped — staff may enter any range.
|
|
*/
|
|
@ApiPropertyOptional({ description: 'Validity start (ISO date)' })
|
|
@IsOptional()
|
|
@IsDateString()
|
|
validFrom?: string;
|
|
|
|
@ApiPropertyOptional({ description: 'Validity end (ISO date)' })
|
|
@IsOptional()
|
|
@IsDateString()
|
|
validUntil?: string;
|
|
|
|
/**
|
|
* Optional per-contract document override edited by staff in the accept
|
|
* dialog. When present its articles are frozen onto THIS contract; when
|
|
* omitted the live template is snapshotted as-is. Never edits the shared
|
|
* six templates.
|
|
*/
|
|
@ApiPropertyOptional({ type: UpdateContractDocumentDto })
|
|
@IsOptional()
|
|
@ValidateNested()
|
|
@Type(() => UpdateContractDocumentDto)
|
|
documentSnapshot?: UpdateContractDocumentDto;
|
|
}
|