108 lines
1.9 KiB
TypeScript
108 lines
1.9 KiB
TypeScript
import { IsString, IsOptional, IsDecimal, IsArray } from 'class-validator';
|
|
import { Type } from 'class-transformer';
|
|
import { ValidateNested } from 'class-validator';
|
|
|
|
export class MachineComponentSelectionDto {
|
|
@IsString()
|
|
requirementId: string;
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
componentModelId?: string;
|
|
|
|
@IsOptional()
|
|
definition?: any;
|
|
}
|
|
|
|
export class MachinePieceSelectionDto {
|
|
@IsString()
|
|
requirementId: string;
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
pieceModelId?: string;
|
|
|
|
@IsOptional()
|
|
definition?: any;
|
|
}
|
|
|
|
export class CreateMachineDto {
|
|
@IsString()
|
|
name: string;
|
|
|
|
@IsString()
|
|
siteId: string;
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
reference?: string;
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
constructeurId?: string;
|
|
|
|
@IsOptional()
|
|
@IsDecimal()
|
|
prix?: string;
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
emplacement?: string;
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
typeMachineId?: string;
|
|
|
|
@IsOptional()
|
|
@IsArray()
|
|
@ValidateNested({ each: true })
|
|
@Type(() => MachineComponentSelectionDto)
|
|
componentSelections?: MachineComponentSelectionDto[];
|
|
|
|
@IsOptional()
|
|
@IsArray()
|
|
@ValidateNested({ each: true })
|
|
@Type(() => MachinePieceSelectionDto)
|
|
pieceSelections?: MachinePieceSelectionDto[];
|
|
}
|
|
|
|
export class UpdateMachineDto {
|
|
@IsOptional()
|
|
@IsString()
|
|
name?: string;
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
reference?: string;
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
constructeurId?: string;
|
|
|
|
@IsOptional()
|
|
@IsDecimal()
|
|
prix?: string;
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
emplacement?: string;
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
typeMachineId?: string;
|
|
}
|
|
|
|
export class ReconfigureMachineDto {
|
|
@IsOptional()
|
|
@IsArray()
|
|
@ValidateNested({ each: true })
|
|
@Type(() => MachineComponentSelectionDto)
|
|
componentSelections?: MachineComponentSelectionDto[];
|
|
|
|
@IsOptional()
|
|
@IsArray()
|
|
@ValidateNested({ each: true })
|
|
@Type(() => MachinePieceSelectionDto)
|
|
pieceSelections?: MachinePieceSelectionDto[];
|
|
}
|