mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 23:28:11 +00:00
67 lines
1.6 KiB
TypeScript
67 lines
1.6 KiB
TypeScript
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
import { IsEnum, IsNumber, IsOptional, IsString, IsUUID, Matches, MaxLength, Min } from 'class-validator';
|
|
|
|
import { WAREHOUSE_STATUSES, WAREHOUSE_TYPES, WarehouseStatus, WarehouseType } from '../entities/warehouse.entity';
|
|
|
|
export class CreateWarehouseDto {
|
|
@ApiProperty()
|
|
@IsString()
|
|
@MaxLength(160)
|
|
@Matches(/^[A-Za-z\s]+$/, { message: 'name may only contain letters and spaces' })
|
|
name!: string;
|
|
|
|
@ApiProperty()
|
|
@IsString()
|
|
@MaxLength(40)
|
|
code!: string;
|
|
|
|
@ApiProperty({ enum: WAREHOUSE_TYPES })
|
|
@IsEnum(WAREHOUSE_TYPES)
|
|
type!: WarehouseType;
|
|
|
|
@ApiPropertyOptional({ format: 'uuid' })
|
|
@IsOptional()
|
|
@IsUUID()
|
|
stationId?: string;
|
|
|
|
@ApiPropertyOptional({ format: 'uuid', description: 'Parent facility / port this warehouse belongs to.' })
|
|
@IsOptional()
|
|
@IsUUID()
|
|
facilityId?: string;
|
|
|
|
@ApiPropertyOptional()
|
|
@IsOptional()
|
|
@IsString()
|
|
@MaxLength(200)
|
|
locationName?: string;
|
|
|
|
@ApiPropertyOptional()
|
|
@IsOptional()
|
|
@IsNumber()
|
|
@Min(0)
|
|
capacityWeight?: number;
|
|
|
|
@ApiPropertyOptional()
|
|
@IsOptional()
|
|
@IsNumber()
|
|
@Min(0)
|
|
capacityContainers?: number;
|
|
|
|
@ApiPropertyOptional({ description: 'Max weight capacity (t). Defaults to capacityWeight.' })
|
|
@IsOptional()
|
|
@IsNumber()
|
|
@Min(0)
|
|
maxWeight?: number;
|
|
|
|
@ApiPropertyOptional({ description: 'Max volume capacity (m³).' })
|
|
@IsOptional()
|
|
@IsNumber()
|
|
@Min(0)
|
|
maxVolume?: number;
|
|
|
|
@ApiPropertyOptional({ enum: WAREHOUSE_STATUSES, default: 'ACTIVE' })
|
|
@IsOptional()
|
|
@IsEnum(WAREHOUSE_STATUSES)
|
|
status?: WarehouseStatus;
|
|
}
|