This repository has been archived on 2026-04-01. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
Inventory_backend/src/shared/dto/machine.dto.ts
2025-09-22 10:19:33 +02:00

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[];
}