refactor: nestjs

This commit is contained in:
Ahmed Bouhuolia
2025-03-22 20:36:48 +02:00
parent 136cc907bb
commit 2eb56e5850
45 changed files with 1210 additions and 198 deletions

View File

@@ -1,3 +1,4 @@
import { ApiProperty } from '@nestjs/swagger';
import { Type } from 'class-transformer';
import {
IsArray,
@@ -39,32 +40,68 @@ export class WarehouseTransferEntryDto {
export class CommandWarehouseTransferDto {
@IsNotEmpty()
@IsInt()
@ApiProperty({
description: 'The id of the warehouse to transfer from',
example: 1,
})
fromWarehouseId: number;
@IsNotEmpty()
@IsInt()
@ApiProperty({
description: 'The id of the warehouse to transfer to',
example: 2,
})
toWarehouseId: number;
@IsNotEmpty()
@IsDate()
@ApiProperty({
description: 'The date of the warehouse transfer',
example: '2021-01-01',
})
date: Date;
@IsOptional()
@IsString()
@ApiProperty({
description: 'The transaction number of the warehouse transfer',
example: '123456',
})
transactionNumber?: string;
@IsBoolean()
@IsOptional()
@ApiProperty({
description: 'Whether the warehouse transfer has been initiated',
example: false,
})
transferInitiated: boolean = false;
@IsBoolean()
@IsOptional()
@ApiProperty({
description: 'Whether the warehouse transfer has been delivered',
example: false,
})
transferDelivered: boolean = false;
@IsArray()
@ArrayMinSize(1)
@ValidateNested({ each: true })
@Type(() => WarehouseTransferEntryDto)
@ApiProperty({
description: 'The entries of the warehouse transfer',
example: [
{
index: 1,
itemId: 1,
description: 'This is a description',
quantity: 100,
cost: 100,
},
],
})
entries: WarehouseTransferEntryDto[];
}