F3.1: definir alta guiada de estructura de Inventario
This commit is contained in:
@@ -0,0 +1,56 @@
|
|||||||
|
import { Transform } from 'class-transformer';
|
||||||
|
import {
|
||||||
|
IsIn,
|
||||||
|
IsOptional,
|
||||||
|
IsString,
|
||||||
|
IsUUID,
|
||||||
|
Matches,
|
||||||
|
MaxLength,
|
||||||
|
MinLength,
|
||||||
|
} from 'class-validator';
|
||||||
|
|
||||||
|
export const INVENTORY_STRUCTURE_KINDS = [
|
||||||
|
'AREA',
|
||||||
|
'YACIMIENTO',
|
||||||
|
'INSTALACION',
|
||||||
|
'SUBINSTALACION',
|
||||||
|
] as const;
|
||||||
|
export type InventoryStructureKind = typeof INVENTORY_STRUCTURE_KINDS[number];
|
||||||
|
|
||||||
|
export class CreateInventoryStructureDto {
|
||||||
|
@IsIn(INVENTORY_STRUCTURE_KINDS)
|
||||||
|
kind!: InventoryStructureKind;
|
||||||
|
|
||||||
|
@IsOptional()
|
||||||
|
@Transform(({ value }) => typeof value === 'string' && value.trim() ? value.trim().toUpperCase() : null)
|
||||||
|
@IsString()
|
||||||
|
@MaxLength(120)
|
||||||
|
@Matches(/^[A-Z0-9][A-Z0-9._/-]*$/)
|
||||||
|
code?: string | null;
|
||||||
|
|
||||||
|
@Transform(({ value }) => typeof value === 'string' ? value.trim() : value)
|
||||||
|
@IsString()
|
||||||
|
@MinLength(1)
|
||||||
|
@MaxLength(200)
|
||||||
|
name!: string;
|
||||||
|
|
||||||
|
@IsOptional()
|
||||||
|
@Transform(({ value }) => typeof value === 'string' && value.trim() ? value.trim() : null)
|
||||||
|
@IsString()
|
||||||
|
@MaxLength(200)
|
||||||
|
commonName?: string | null;
|
||||||
|
|
||||||
|
@IsOptional()
|
||||||
|
@IsUUID('4')
|
||||||
|
parentId?: string | null;
|
||||||
|
|
||||||
|
@IsOptional()
|
||||||
|
@IsUUID('4')
|
||||||
|
familyId?: string | null;
|
||||||
|
|
||||||
|
@IsOptional()
|
||||||
|
@Transform(({ value }) => typeof value === 'string' && value.trim() ? value.trim() : null)
|
||||||
|
@IsString()
|
||||||
|
@MaxLength(4000)
|
||||||
|
description?: string | null;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user