chore: import DH V2 D5.6.4 production baseline
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
import { Transform, Type } from 'class-transformer';
|
||||
import { IsIn, IsInt, IsOptional, IsString, IsUUID, Matches, Max, MaxLength, Min } from 'class-validator';
|
||||
|
||||
export const VERIFICATION_PLANNING_STATUSES = ['ALL', 'UNPLANNED', 'PLANNED'] as const;
|
||||
export type VerificationPlanningStatus = typeof VERIFICATION_PLANNING_STATUSES[number];
|
||||
|
||||
const normalizeText = ({ value }: { value: unknown }) =>
|
||||
typeof value === 'string' ? value.trim() : value;
|
||||
|
||||
export class ListVerificationPlanningQueryDto {
|
||||
@IsOptional()
|
||||
@Type(() => Number)
|
||||
@IsInt()
|
||||
@Min(1)
|
||||
page = 1;
|
||||
|
||||
@IsOptional()
|
||||
@Type(() => Number)
|
||||
@IsInt()
|
||||
@Min(1)
|
||||
@Max(100)
|
||||
pageSize = 50;
|
||||
|
||||
@IsOptional()
|
||||
@Transform(normalizeText)
|
||||
@IsString()
|
||||
@MaxLength(180)
|
||||
search?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsIn(VERIFICATION_PLANNING_STATUSES)
|
||||
planningStatus: VerificationPlanningStatus = 'UNPLANNED';
|
||||
|
||||
@IsOptional()
|
||||
@IsUUID('4')
|
||||
companyId?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsUUID('4')
|
||||
areaId?: string;
|
||||
|
||||
@IsOptional()
|
||||
@Matches(/^\d{4}-\d{2}-\d{2}$/)
|
||||
dueFrom?: string;
|
||||
|
||||
@IsOptional()
|
||||
@Matches(/^\d{4}-\d{2}-\d{2}$/)
|
||||
dueTo?: string;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import { Transform } from 'class-transformer';
|
||||
import { ArrayMaxSize, ArrayMinSize, IsArray, IsISO8601, IsOptional, IsString, IsUUID, MaxLength } from 'class-validator';
|
||||
|
||||
const optionalText = ({ value }: { value: unknown }) =>
|
||||
typeof value === 'string' && value.trim() ? value.trim() : null;
|
||||
|
||||
export class PlanVerificationVisitDto {
|
||||
@IsArray()
|
||||
@ArrayMinSize(1)
|
||||
@ArrayMaxSize(100)
|
||||
@IsUUID('4', { each: true })
|
||||
findingIds!: string[];
|
||||
|
||||
@IsISO8601({ strict: true })
|
||||
plannedStartAt!: string;
|
||||
|
||||
@IsOptional()
|
||||
@Transform(optionalText)
|
||||
@IsString()
|
||||
@MaxLength(4000)
|
||||
notes?: string | null;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import { IsEnum, IsISO8601, IsOptional, IsString, Matches, MaxLength, MinLength, ValidateIf } from 'class-validator';
|
||||
import { InspectionVerificationOutcome } from '../../database/entities';
|
||||
|
||||
export class RecordVerificationResultDto {
|
||||
@IsEnum(InspectionVerificationOutcome)
|
||||
outcome!: InspectionVerificationOutcome;
|
||||
|
||||
@IsString()
|
||||
@MinLength(5)
|
||||
@MaxLength(4000)
|
||||
notes!: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsISO8601({ strict: true })
|
||||
verifiedAt?: string;
|
||||
|
||||
@ValidateIf((value: RecordVerificationResultDto) => value.outcome === InspectionVerificationOutcome.REQUIRES_NEW_DATE)
|
||||
@Matches(/^\d{4}-\d{2}-\d{2}$/)
|
||||
nextControlOn?: string;
|
||||
}
|
||||
Reference in New Issue
Block a user