chore: import DH V2 D5.6.4 production baseline
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import { Transform } from 'class-transformer';
|
||||
import { IsString, MaxLength, MinLength } from 'class-validator';
|
||||
|
||||
const normalizeText = ({ value }: { value: unknown }) =>
|
||||
typeof value === 'string' ? value.trim() : value;
|
||||
|
||||
export class CloseInspectionFindingDto {
|
||||
@Transform(normalizeText)
|
||||
@IsString()
|
||||
@MinLength(3)
|
||||
@MaxLength(5000)
|
||||
closureNotes!: string;
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
import { Transform, Type } from 'class-transformer';
|
||||
import { IsInt, IsOptional, IsString, IsUUID, Matches, Max, MaxLength, Min, MinLength } from 'class-validator';
|
||||
|
||||
const trimNullable = ({ value }: { value: unknown }) =>
|
||||
typeof value === 'string' ? value.trim() || null : value;
|
||||
|
||||
export class CreateFindingCatalogItemDto {
|
||||
@IsUUID('4')
|
||||
categoryId!: string;
|
||||
|
||||
@Transform(({ value }) => typeof value === 'string' ? value.trim().toUpperCase() : value)
|
||||
@IsString()
|
||||
@MinLength(2)
|
||||
@MaxLength(120)
|
||||
@Matches(/^[A-Z][A-Z0-9_]+$/)
|
||||
code!: string;
|
||||
|
||||
@Type(() => Number)
|
||||
@IsInt()
|
||||
@Min(1)
|
||||
@Max(999999)
|
||||
sourceNumber!: number;
|
||||
|
||||
@Transform(({ value }) => typeof value === 'string' ? value.trim() : value)
|
||||
@IsString()
|
||||
@MinLength(1)
|
||||
@MaxLength(500)
|
||||
title!: string;
|
||||
|
||||
@IsOptional()
|
||||
@Transform(trimNullable)
|
||||
@IsString()
|
||||
@MaxLength(12000)
|
||||
legalBasis?: string | null;
|
||||
|
||||
@IsOptional()
|
||||
@Transform(trimNullable)
|
||||
@IsString()
|
||||
@MaxLength(12000)
|
||||
glossary?: string | null;
|
||||
|
||||
@IsOptional()
|
||||
@Transform(trimNullable)
|
||||
@IsString()
|
||||
@MaxLength(4000)
|
||||
importNote?: string | null;
|
||||
|
||||
@IsOptional()
|
||||
@Type(() => Number)
|
||||
@IsInt()
|
||||
@Min(1)
|
||||
@Max(10)
|
||||
suggestedSeverity?: number | null;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
import { Transform, Type } from 'class-transformer';
|
||||
import { IsInt, IsString, Matches, Max, MaxLength, Min, MinLength } from 'class-validator';
|
||||
|
||||
export class CreateFindingCategoryDto {
|
||||
@Transform(({ value }) => typeof value === 'string' ? value.trim().toUpperCase() : value)
|
||||
@IsString()
|
||||
@MinLength(2)
|
||||
@MaxLength(80)
|
||||
@Matches(/^[A-Z][A-Z0-9_]+$/)
|
||||
code!: string;
|
||||
|
||||
@Transform(({ value }) => typeof value === 'string' ? value.trim() : value)
|
||||
@IsString()
|
||||
@MinLength(1)
|
||||
@MaxLength(200)
|
||||
name!: string;
|
||||
|
||||
@Type(() => Number)
|
||||
@IsInt()
|
||||
@Min(0)
|
||||
@Max(10000)
|
||||
sortOrder!: number;
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
import { Transform } from 'class-transformer';
|
||||
import {
|
||||
IsEmail,
|
||||
IsEnum,
|
||||
IsISO8601,
|
||||
IsOptional,
|
||||
IsString,
|
||||
MaxLength,
|
||||
MinLength,
|
||||
} from 'class-validator';
|
||||
import {
|
||||
InspectionCommunicationChannel,
|
||||
InspectionCommunicationDirection,
|
||||
InspectionCommunicationType,
|
||||
} from '../../database/entities';
|
||||
|
||||
const trim = ({ value }: { value: unknown }) =>
|
||||
typeof value === 'string' ? value.trim() : value;
|
||||
|
||||
const optionalText = ({ value }: { value: unknown }) =>
|
||||
typeof value === 'string' && value.trim() ? value.trim() : null;
|
||||
|
||||
export class CreateInspectionCommunicationDto {
|
||||
@IsEnum(InspectionCommunicationDirection)
|
||||
direction!: InspectionCommunicationDirection;
|
||||
|
||||
@IsEnum(InspectionCommunicationChannel)
|
||||
channel!: InspectionCommunicationChannel;
|
||||
|
||||
@IsEnum(InspectionCommunicationType)
|
||||
type!: InspectionCommunicationType;
|
||||
|
||||
@IsISO8601({ strict: true })
|
||||
occurredAt!: string;
|
||||
|
||||
@Transform(trim)
|
||||
@IsString()
|
||||
@MinLength(1)
|
||||
@MaxLength(250)
|
||||
subject!: string;
|
||||
|
||||
@IsOptional()
|
||||
@Transform(optionalText)
|
||||
@IsString()
|
||||
@MaxLength(10000)
|
||||
details?: string | null;
|
||||
|
||||
@IsOptional()
|
||||
@Transform(optionalText)
|
||||
@IsString()
|
||||
@MaxLength(200)
|
||||
contactName?: string | null;
|
||||
|
||||
@IsOptional()
|
||||
@Transform(optionalText)
|
||||
@IsEmail()
|
||||
@MaxLength(320)
|
||||
contactEmail?: string | null;
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
import { Type } from 'class-transformer';
|
||||
import {
|
||||
IsEnum,
|
||||
IsISO8601,
|
||||
IsNumber,
|
||||
IsOptional,
|
||||
IsString,
|
||||
IsUUID,
|
||||
Max,
|
||||
MaxLength,
|
||||
Min,
|
||||
} from 'class-validator';
|
||||
import {
|
||||
InspectionEvidenceKind,
|
||||
InspectionEvidencePurpose,
|
||||
} from '../../database/entities';
|
||||
|
||||
export class CreateInspectionEvidenceDto {
|
||||
@IsEnum(InspectionEvidenceKind)
|
||||
kind!: InspectionEvidenceKind;
|
||||
|
||||
@IsEnum(InspectionEvidencePurpose)
|
||||
purpose!: InspectionEvidencePurpose;
|
||||
|
||||
@IsOptional()
|
||||
@IsUUID('4')
|
||||
communicationId?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsUUID('4')
|
||||
verificationVisitId?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@MaxLength(200)
|
||||
title?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@MaxLength(4000)
|
||||
description?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsISO8601({ strict: true })
|
||||
capturedAt?: string;
|
||||
|
||||
@IsOptional()
|
||||
@Type(() => Number)
|
||||
@IsNumber({ maxDecimalPlaces: 6 })
|
||||
@Min(-90)
|
||||
@Max(90)
|
||||
latitude?: number;
|
||||
|
||||
@IsOptional()
|
||||
@Type(() => Number)
|
||||
@IsNumber({ maxDecimalPlaces: 6 })
|
||||
@Min(-180)
|
||||
@Max(180)
|
||||
longitude?: number;
|
||||
|
||||
@IsOptional()
|
||||
@Type(() => Number)
|
||||
@IsNumber({ maxDecimalPlaces: 3 })
|
||||
@Min(0)
|
||||
@Max(100000)
|
||||
accuracyM?: number;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@MaxLength(200)
|
||||
deviceLabel?: string;
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
import { Transform, Type } from 'class-transformer';
|
||||
import {
|
||||
IsInt,
|
||||
IsOptional,
|
||||
IsString,
|
||||
IsUUID,
|
||||
Matches,
|
||||
Max,
|
||||
MaxLength,
|
||||
Min,
|
||||
MinLength,
|
||||
ValidateIf,
|
||||
} from 'class-validator';
|
||||
|
||||
const optionalText = ({ value }: { value: unknown }) =>
|
||||
typeof value === 'string' && value.trim() ? value.trim() : null;
|
||||
|
||||
export class CreateInspectionFindingDto {
|
||||
@IsUUID('4')
|
||||
assetId!: string;
|
||||
|
||||
@IsOptional()
|
||||
@Transform(optionalText)
|
||||
@IsUUID('4')
|
||||
catalogItemId?: string | null;
|
||||
|
||||
@ValidateIf((value: CreateInspectionFindingDto) => !value.catalogItemId)
|
||||
@Transform(optionalText)
|
||||
@IsString()
|
||||
@MinLength(1)
|
||||
@MaxLength(500)
|
||||
customTitle?: string | null;
|
||||
|
||||
@IsOptional()
|
||||
@Transform(optionalText)
|
||||
@IsString()
|
||||
@MaxLength(12000)
|
||||
customLegalBasis?: string | null;
|
||||
|
||||
@Transform(({ value }) => (typeof value === 'string' ? value.trim() : value))
|
||||
@IsString()
|
||||
@MinLength(1)
|
||||
@MaxLength(20000)
|
||||
description!: string;
|
||||
|
||||
@IsOptional()
|
||||
@Type(() => Number)
|
||||
@IsInt()
|
||||
@Min(1)
|
||||
@Max(10)
|
||||
severity?: number;
|
||||
|
||||
@IsOptional()
|
||||
@Transform(optionalText)
|
||||
@Matches(/^\d{4}-\d{2}-\d{2}$/)
|
||||
correctionDueOn?: string | null;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { IsEnum, IsOptional, IsUUID } from 'class-validator';
|
||||
import { FindingCatalogProposalStatus } from '../../database/entities';
|
||||
|
||||
export class ListFindingCatalogProposalsQueryDto {
|
||||
@IsOptional()
|
||||
@IsEnum(FindingCatalogProposalStatus)
|
||||
status?: FindingCatalogProposalStatus;
|
||||
|
||||
@IsOptional()
|
||||
@IsUUID('4')
|
||||
assetTypeId?: string;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import { Transform } from 'class-transformer';
|
||||
import { IsOptional, IsString, IsUUID, MaxLength } from 'class-validator';
|
||||
|
||||
export class ListFindingCatalogQueryDto {
|
||||
@IsOptional()
|
||||
@IsUUID('4')
|
||||
categoryId?: string;
|
||||
|
||||
@IsOptional()
|
||||
@Transform(({ value }) => (typeof value === 'string' ? value.trim() : value))
|
||||
@IsString()
|
||||
@MaxLength(200)
|
||||
search?: string;
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
import { Transform, Type } from 'class-transformer';
|
||||
import { IsIn, IsInt, IsOptional, IsString, IsUUID, Matches, Max, MaxLength, Min } from 'class-validator';
|
||||
|
||||
export const FINDING_WORKFLOWS = [
|
||||
'ALL',
|
||||
'OPEN',
|
||||
'WAITING_COMPANY',
|
||||
'COMPANY_OVERDUE',
|
||||
'TO_SCHEDULE_VERIFICATION',
|
||||
'TO_VERIFY',
|
||||
'VERIFICATION_OVERDUE',
|
||||
'READY_TO_CLOSE',
|
||||
'CLOSED',
|
||||
] as const;
|
||||
|
||||
export type FindingWorkflow = typeof FINDING_WORKFLOWS[number];
|
||||
|
||||
const normalizeText = ({ value }: { value: unknown }) =>
|
||||
typeof value === 'string' ? value.trim() : value;
|
||||
|
||||
export class ListInspectionFindingsQueryDto {
|
||||
@IsOptional()
|
||||
@Type(() => Number)
|
||||
@IsInt()
|
||||
@Min(1)
|
||||
page = 1;
|
||||
|
||||
@IsOptional()
|
||||
@Type(() => Number)
|
||||
@IsInt()
|
||||
@Min(1)
|
||||
@Max(100)
|
||||
pageSize = 25;
|
||||
|
||||
@IsOptional()
|
||||
@Transform(normalizeText)
|
||||
@IsString()
|
||||
@MaxLength(180)
|
||||
search?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsIn(FINDING_WORKFLOWS)
|
||||
workflow: FindingWorkflow = 'OPEN';
|
||||
|
||||
@IsOptional()
|
||||
@IsUUID('4')
|
||||
companyId?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsUUID('4')
|
||||
areaId?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsUUID('4')
|
||||
inspectorId?: string;
|
||||
|
||||
@IsOptional()
|
||||
@Matches(/^\d{4}-\d{2}-\d{2}$/)
|
||||
dateFrom?: string;
|
||||
|
||||
@IsOptional()
|
||||
@Matches(/^\d{4}-\d{2}-\d{2}$/)
|
||||
dateTo?: string;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import { Transform } from 'class-transformer';
|
||||
import { ArrayUnique, IsArray, IsString, IsUUID, MaxLength, MinLength } from 'class-validator';
|
||||
|
||||
export class ReplaceFindingCatalogSelectionDto {
|
||||
@IsArray()
|
||||
@ArrayUnique()
|
||||
@IsUUID('4', { each: true })
|
||||
enabledItemIds!: string[];
|
||||
|
||||
@Transform(({ value }) => typeof value === 'string' ? value.trim() : value)
|
||||
@IsString()
|
||||
@MinLength(5)
|
||||
@MaxLength(2000)
|
||||
reason!: string;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
import { Transform } from 'class-transformer';
|
||||
import { IsEnum, IsOptional, IsString, IsUUID, MaxLength, MinLength, ValidateIf } from 'class-validator';
|
||||
|
||||
export enum FindingCatalogProposalDecision {
|
||||
MATCH = 'MATCH',
|
||||
REJECT = 'REJECT',
|
||||
}
|
||||
|
||||
export class ReviewFindingCatalogProposalDto {
|
||||
@IsEnum(FindingCatalogProposalDecision)
|
||||
decision!: FindingCatalogProposalDecision;
|
||||
|
||||
@ValidateIf((value: ReviewFindingCatalogProposalDto) => value.decision === FindingCatalogProposalDecision.MATCH)
|
||||
@IsUUID('4')
|
||||
catalogItemId?: string;
|
||||
|
||||
@IsOptional()
|
||||
@Transform(({ value }) => typeof value === 'string' ? value.trim() || null : value)
|
||||
@IsString()
|
||||
@MinLength(5)
|
||||
@MaxLength(4000)
|
||||
notes?: string | null;
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
import { Transform, Type } from 'class-transformer';
|
||||
import { IsBoolean, IsInt, IsOptional, IsString, IsUUID, Max, MaxLength, Min, MinLength } from 'class-validator';
|
||||
|
||||
const trimNullable = ({ value }: { value: unknown }) =>
|
||||
typeof value === 'string' ? value.trim() || null : value;
|
||||
|
||||
export class UpdateFindingCatalogItemDto {
|
||||
@IsOptional()
|
||||
@IsUUID('4')
|
||||
categoryId?: string;
|
||||
|
||||
@IsOptional()
|
||||
@Type(() => Number)
|
||||
@IsInt()
|
||||
@Min(1)
|
||||
@Max(999999)
|
||||
sourceNumber?: number;
|
||||
|
||||
@IsOptional()
|
||||
@Transform(({ value }) => typeof value === 'string' ? value.trim() : value)
|
||||
@IsString()
|
||||
@MinLength(1)
|
||||
@MaxLength(500)
|
||||
title?: string;
|
||||
|
||||
@IsOptional()
|
||||
@Transform(trimNullable)
|
||||
@IsString()
|
||||
@MaxLength(12000)
|
||||
legalBasis?: string | null;
|
||||
|
||||
@IsOptional()
|
||||
@Transform(trimNullable)
|
||||
@IsString()
|
||||
@MaxLength(12000)
|
||||
glossary?: string | null;
|
||||
|
||||
@IsOptional()
|
||||
@Transform(trimNullable)
|
||||
@IsString()
|
||||
@MaxLength(4000)
|
||||
importNote?: string | null;
|
||||
|
||||
@IsOptional()
|
||||
@Type(() => Number)
|
||||
@IsInt()
|
||||
@Min(1)
|
||||
@Max(10)
|
||||
suggestedSeverity?: number | null;
|
||||
|
||||
@IsOptional()
|
||||
@IsBoolean()
|
||||
isActive?: boolean;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import { Transform, Type } from 'class-transformer';
|
||||
import { IsBoolean, IsInt, IsOptional, IsString, Max, MaxLength, Min, MinLength } from 'class-validator';
|
||||
|
||||
export class UpdateFindingCategoryDto {
|
||||
@IsOptional()
|
||||
@Transform(({ value }) => typeof value === 'string' ? value.trim() : value)
|
||||
@IsString()
|
||||
@MinLength(1)
|
||||
@MaxLength(200)
|
||||
name?: string;
|
||||
|
||||
@IsOptional()
|
||||
@Type(() => Number)
|
||||
@IsInt()
|
||||
@Min(0)
|
||||
@Max(10000)
|
||||
sortOrder?: number;
|
||||
|
||||
@IsOptional()
|
||||
@IsBoolean()
|
||||
isActive?: boolean;
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
import { Transform, Type } from 'class-transformer';
|
||||
import {
|
||||
IsEnum,
|
||||
IsInt,
|
||||
IsOptional,
|
||||
IsString,
|
||||
Matches,
|
||||
Max,
|
||||
MaxLength,
|
||||
Min,
|
||||
MinLength,
|
||||
} from 'class-validator';
|
||||
import { InspectionFindingResponseDueBasis } from '../../database/entities';
|
||||
|
||||
const optionalText = ({ value }: { value: unknown }) =>
|
||||
typeof value === 'string' && value.trim() ? value.trim() : null;
|
||||
|
||||
const optionalDate = ({ value }: { value: unknown }) =>
|
||||
typeof value === 'string' && value.trim() ? value.trim() : null;
|
||||
|
||||
export class UpdateInspectionFindingFollowUpDto {
|
||||
@IsOptional()
|
||||
@IsEnum(InspectionFindingResponseDueBasis)
|
||||
responseDueBasis?: InspectionFindingResponseDueBasis | null;
|
||||
|
||||
@IsOptional()
|
||||
@Type(() => Number)
|
||||
@IsInt()
|
||||
@Min(0)
|
||||
@Max(3650)
|
||||
responseDueDays?: number | null;
|
||||
|
||||
@IsOptional()
|
||||
@Transform(optionalDate)
|
||||
@Matches(/^\d{4}-\d{2}-\d{2}$/)
|
||||
reportNotifiedOn?: string | null;
|
||||
|
||||
@IsOptional()
|
||||
@Transform(optionalText)
|
||||
@IsString()
|
||||
@MinLength(1)
|
||||
@MaxLength(20000)
|
||||
companyResponse?: string | null;
|
||||
|
||||
@IsOptional()
|
||||
@Transform(optionalDate)
|
||||
@Matches(/^\d{4}-\d{2}-\d{2}$/)
|
||||
companyResponseReceivedOn?: string | null;
|
||||
|
||||
@IsOptional()
|
||||
@Transform(optionalDate)
|
||||
@Matches(/^\d{4}-\d{2}-\d{2}$/)
|
||||
companyCommittedCorrectionOn?: string | null;
|
||||
|
||||
@IsOptional()
|
||||
@Transform(optionalDate)
|
||||
@Matches(/^\d{4}-\d{2}-\d{2}$/)
|
||||
nextControlOn?: string | null;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
import { Transform, Type } from 'class-transformer';
|
||||
import {
|
||||
IsInt,
|
||||
IsOptional,
|
||||
IsString,
|
||||
IsUUID,
|
||||
Matches,
|
||||
Max,
|
||||
MaxLength,
|
||||
Min,
|
||||
MinLength,
|
||||
} from 'class-validator';
|
||||
|
||||
const optionalDate = ({ value }: { value: unknown }) =>
|
||||
typeof value === 'string' && value.trim() ? value.trim() : null;
|
||||
|
||||
export class UpdateInspectionFindingDto {
|
||||
@IsOptional()
|
||||
@IsUUID('4')
|
||||
assetId?: string;
|
||||
|
||||
@IsOptional()
|
||||
@Transform(({ value }) => (typeof value === 'string' ? value.trim() : value))
|
||||
@IsString()
|
||||
@MinLength(1)
|
||||
@MaxLength(20000)
|
||||
description?: string;
|
||||
|
||||
@IsOptional()
|
||||
@Type(() => Number)
|
||||
@IsInt()
|
||||
@Min(1)
|
||||
@Max(10)
|
||||
severity?: number;
|
||||
|
||||
@IsOptional()
|
||||
@Transform(optionalDate)
|
||||
@Matches(/^\d{4}-\d{2}-\d{2}$/)
|
||||
correctionDueOn?: string | null;
|
||||
}
|
||||
Reference in New Issue
Block a user