feat: auto populate machine structures and seed sample data
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { IsString, IsOptional, IsNumber } from 'class-validator';
|
||||
import { IsString, IsOptional, IsNumber, IsObject } from 'class-validator';
|
||||
import { Transform } from 'class-transformer';
|
||||
|
||||
export class CreateComposantDto {
|
||||
@@ -33,6 +33,10 @@ export class CreateComposantDto {
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
typeMachineComponentRequirementId?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsObject()
|
||||
structure?: Record<string, any>;
|
||||
}
|
||||
|
||||
export class UpdateComposantDto {
|
||||
@@ -56,4 +60,8 @@ export class UpdateComposantDto {
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
typeComposantId?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsObject()
|
||||
structure?: Record<string, any>;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,22 @@
|
||||
import { IsString, IsOptional, IsDecimal, IsArray } from 'class-validator';
|
||||
import {
|
||||
IsString,
|
||||
IsOptional,
|
||||
IsDecimal,
|
||||
IsArray,
|
||||
IsObject,
|
||||
} from 'class-validator';
|
||||
import { Type } from 'class-transformer';
|
||||
import { ValidateNested } from 'class-validator';
|
||||
|
||||
export class MachineComponentSelectionDto {
|
||||
export class MachineComponentLinkPayloadDto {
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
id?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
linkId?: string;
|
||||
|
||||
@IsString()
|
||||
requirementId: string;
|
||||
|
||||
@@ -15,10 +29,59 @@ export class MachineComponentSelectionDto {
|
||||
composantId?: string;
|
||||
|
||||
@IsOptional()
|
||||
definition?: any;
|
||||
@IsString()
|
||||
componentId?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
parentLinkId?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
parentComponentLinkId?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
parentRequirementId?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
parentComponentRequirementId?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
parentPieceRequirementId?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
parentMachineComponentRequirementId?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
parentMachinePieceRequirementId?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
parentComponentId?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
parentPieceId?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsObject()
|
||||
overrides?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export class MachinePieceSelectionDto {
|
||||
export class MachinePieceLinkPayloadDto {
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
id?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
linkId?: string;
|
||||
|
||||
@IsString()
|
||||
requirementId: string;
|
||||
|
||||
@@ -31,7 +94,52 @@ export class MachinePieceSelectionDto {
|
||||
pieceId?: string;
|
||||
|
||||
@IsOptional()
|
||||
definition?: any;
|
||||
@IsString()
|
||||
composantId?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
parentLinkId?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
parentComponentLinkId?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
parentPieceLinkId?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
parentRequirementId?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
parentComponentRequirementId?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
parentPieceRequirementId?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
parentMachineComponentRequirementId?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
parentMachinePieceRequirementId?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
parentComponentId?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
parentPieceId?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsObject()
|
||||
overrides?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export class CreateMachineDto {
|
||||
@@ -60,14 +168,14 @@ export class CreateMachineDto {
|
||||
@IsOptional()
|
||||
@IsArray()
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => MachineComponentSelectionDto)
|
||||
componentSelections?: MachineComponentSelectionDto[];
|
||||
@Type(() => MachineComponentLinkPayloadDto)
|
||||
componentLinks?: MachineComponentLinkPayloadDto[];
|
||||
|
||||
@IsOptional()
|
||||
@IsArray()
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => MachinePieceSelectionDto)
|
||||
pieceSelections?: MachinePieceSelectionDto[];
|
||||
@Type(() => MachinePieceLinkPayloadDto)
|
||||
pieceLinks?: MachinePieceLinkPayloadDto[];
|
||||
}
|
||||
|
||||
export class UpdateMachineDto {
|
||||
@@ -96,12 +204,15 @@ export class ReconfigureMachineDto {
|
||||
@IsOptional()
|
||||
@IsArray()
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => MachineComponentSelectionDto)
|
||||
componentSelections?: MachineComponentSelectionDto[];
|
||||
@Type(() => MachineComponentLinkPayloadDto)
|
||||
componentLinks?: MachineComponentLinkPayloadDto[];
|
||||
|
||||
@IsOptional()
|
||||
@IsArray()
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => MachinePieceSelectionDto)
|
||||
pieceSelections?: MachinePieceSelectionDto[];
|
||||
@Type(() => MachinePieceLinkPayloadDto)
|
||||
pieceLinks?: MachinePieceLinkPayloadDto[];
|
||||
}
|
||||
|
||||
export type MachineComponentLinkInput = MachineComponentLinkPayloadDto;
|
||||
export type MachinePieceLinkInput = MachinePieceLinkPayloadDto;
|
||||
|
||||
Reference in New Issue
Block a user