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