This commit is contained in:
+6
-1
@@ -26,7 +26,12 @@ async function bootstrap() {
|
||||
await app.register(fastifyCookie);
|
||||
|
||||
await app.register(multipart);
|
||||
app.useGlobalPipes(new ValidationPipe());
|
||||
app.useGlobalPipes(
|
||||
new ValidationPipe({
|
||||
transform: true,
|
||||
whitelist: true,
|
||||
}),
|
||||
);
|
||||
|
||||
app.useGlobalInterceptors(
|
||||
new ResponseInterceptor(),
|
||||
|
||||
@@ -3,6 +3,7 @@ import {
|
||||
ArrayMinSize,
|
||||
IsArray,
|
||||
IsBoolean,
|
||||
IsDefined,
|
||||
IsEnum,
|
||||
IsInt,
|
||||
IsNotEmpty,
|
||||
@@ -118,12 +119,12 @@ export class CreateProductDto {
|
||||
@ApiPropertyOptional({ example: 1 })
|
||||
order?: number;
|
||||
|
||||
@IsOptional()
|
||||
@IsDefined()
|
||||
@IsNumber({ maxDecimalPlaces: 3 })
|
||||
@Min(0.001)
|
||||
@Type(() => Number)
|
||||
@ApiPropertyOptional({ description: 'Maximum quantity per order; omit or null for unlimited', example: 5 })
|
||||
maxPurchaseQuantity?: number | null;
|
||||
@ApiProperty({ description: 'Maximum quantity per order', example: 5 })
|
||||
maxPurchaseQuantity: number;
|
||||
|
||||
@IsOptional()
|
||||
@IsNumber({ maxDecimalPlaces: 3 })
|
||||
@@ -142,11 +143,11 @@ export class CreateProductDto {
|
||||
@ApiPropertyOptional({ example: PurchaseUnit.NUMBER })
|
||||
purchaseUnit?: PurchaseUnit;
|
||||
|
||||
@IsOptional()
|
||||
@IsDefined()
|
||||
@IsNumber({ maxDecimalPlaces: 3 })
|
||||
@Min(0.001)
|
||||
@Type(() => Number)
|
||||
@ApiPropertyOptional({ description: 'Minimum quantity per order; omit or null for unlimited', example: 0.5 })
|
||||
minPurchaseQuantity?: number | null;
|
||||
@ApiProperty({ description: 'Minimum quantity per order', example: 0.5 })
|
||||
minPurchaseQuantity: number;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user