chore: import DH V2 D5.6.4 production baseline
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
import { IsEnum, IsISO8601 } from 'class-validator';
|
||||
import { InspectionActUploadMode } from '../../database/entities';
|
||||
|
||||
export class CloseInspectionActDto {
|
||||
@IsISO8601({ strict: true })
|
||||
clientClosedAt!: string;
|
||||
|
||||
@IsEnum(InspectionActUploadMode)
|
||||
uploadMode!: InspectionActUploadMode;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import { Transform } from 'class-transformer';
|
||||
import { IsIn, IsString, MaxLength, MinLength } from 'class-validator';
|
||||
import { InspectionActSignatureStatus } from '../../database/entities';
|
||||
|
||||
export class CreateCompanyOutcomeDto {
|
||||
@IsIn([
|
||||
InspectionActSignatureStatus.REFUSED,
|
||||
InspectionActSignatureStatus.ABSENT,
|
||||
])
|
||||
status!: InspectionActSignatureStatus.REFUSED | InspectionActSignatureStatus.ABSENT;
|
||||
|
||||
@Transform(({ value }) => (typeof value === 'string' ? value.trim() : value))
|
||||
@IsString()
|
||||
@MinLength(10)
|
||||
@MaxLength(4000)
|
||||
reason!: string;
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
import { Transform, Type } from 'class-transformer';
|
||||
import {
|
||||
Equals,
|
||||
IsBoolean,
|
||||
IsISO8601,
|
||||
IsNumber,
|
||||
IsOptional,
|
||||
IsString,
|
||||
Max,
|
||||
MaxLength,
|
||||
Min,
|
||||
} from 'class-validator';
|
||||
|
||||
export class CreateInspectionSignatureDto {
|
||||
@Transform(({ value }) => value === true || value === 'true')
|
||||
@IsBoolean()
|
||||
@Equals(true)
|
||||
consentAccepted!: boolean;
|
||||
|
||||
@IsOptional()
|
||||
@IsISO8601({ strict: true })
|
||||
clientSignedAt?: 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,77 @@
|
||||
import { Transform } from 'class-transformer';
|
||||
import {
|
||||
IsEmail,
|
||||
IsEnum,
|
||||
IsOptional,
|
||||
IsString,
|
||||
MaxLength,
|
||||
MinLength,
|
||||
ValidateIf,
|
||||
} from 'class-validator';
|
||||
import {
|
||||
InspectionResponsibleAttendanceStatus,
|
||||
InspectionResponsibleDocumentType,
|
||||
} from '../../database/entities';
|
||||
|
||||
const trimOrUndefined = ({ value }: { value: unknown }) => (
|
||||
typeof value === 'string' && value.trim() ? value.trim() : undefined
|
||||
);
|
||||
|
||||
export class UpsertInspectionResponsibleDto {
|
||||
@IsEnum(InspectionResponsibleAttendanceStatus)
|
||||
attendanceStatus!: InspectionResponsibleAttendanceStatus;
|
||||
|
||||
@ValidateIf((dto: UpsertInspectionResponsibleDto) => (
|
||||
dto.attendanceStatus === InspectionResponsibleAttendanceStatus.PRESENT
|
||||
))
|
||||
@Transform(trimOrUndefined)
|
||||
@IsString()
|
||||
@MinLength(1)
|
||||
@MaxLength(200)
|
||||
fullName?: string;
|
||||
|
||||
@ValidateIf((dto: UpsertInspectionResponsibleDto) => (
|
||||
dto.attendanceStatus === InspectionResponsibleAttendanceStatus.PRESENT
|
||||
))
|
||||
@IsEnum(InspectionResponsibleDocumentType)
|
||||
documentType?: InspectionResponsibleDocumentType;
|
||||
|
||||
@ValidateIf((dto: UpsertInspectionResponsibleDto) => (
|
||||
dto.attendanceStatus === InspectionResponsibleAttendanceStatus.PRESENT
|
||||
))
|
||||
@Transform(trimOrUndefined)
|
||||
@IsString()
|
||||
@MinLength(1)
|
||||
@MaxLength(40)
|
||||
documentNumber?: string;
|
||||
|
||||
@ValidateIf((dto: UpsertInspectionResponsibleDto) => (
|
||||
dto.attendanceStatus === InspectionResponsibleAttendanceStatus.PRESENT
|
||||
))
|
||||
@Transform(trimOrUndefined)
|
||||
@IsString()
|
||||
@MinLength(1)
|
||||
@MaxLength(200)
|
||||
position?: string;
|
||||
|
||||
@IsOptional()
|
||||
@Transform(trimOrUndefined)
|
||||
@IsEmail()
|
||||
@MaxLength(320)
|
||||
email?: string;
|
||||
|
||||
@IsOptional()
|
||||
@Transform(trimOrUndefined)
|
||||
@IsString()
|
||||
@MaxLength(50)
|
||||
phone?: string;
|
||||
|
||||
@ValidateIf((dto: UpsertInspectionResponsibleDto) => (
|
||||
dto.attendanceStatus === InspectionResponsibleAttendanceStatus.ABSENT
|
||||
))
|
||||
@Transform(trimOrUndefined)
|
||||
@IsString()
|
||||
@MinLength(10)
|
||||
@MaxLength(4000)
|
||||
absenceReason?: string;
|
||||
}
|
||||
Reference in New Issue
Block a user