From 2108cbc3abbf2c22314009824d9b66bacae1d1d5 Mon Sep 17 00:00:00 2001 From: Rafael Claudio Date: Sun, 15 Oct 2023 13:41:35 -0300 Subject: [PATCH] relates to #2375 - quantity and unitPrice should be positive --- apps/api/src/app/order/create-order.dto.ts | 3 +++ apps/api/src/app/order/update-order.dto.ts | 3 +++ 2 files changed, 6 insertions(+) diff --git a/apps/api/src/app/order/create-order.dto.ts b/apps/api/src/app/order/create-order.dto.ts index 49b193ca5..d4beff752 100644 --- a/apps/api/src/app/order/create-order.dto.ts +++ b/apps/api/src/app/order/create-order.dto.ts @@ -13,6 +13,7 @@ import { IsISO8601, IsNumber, IsOptional, + IsPositive, IsString } from 'class-validator'; import { isString } from 'lodash'; @@ -51,6 +52,7 @@ export class CreateOrderDto { fee: number; @IsNumber() + @IsPositive() quantity: number; @IsString() @@ -64,6 +66,7 @@ export class CreateOrderDto { type: Type; @IsNumber() + @IsPositive() unitPrice: number; @IsBoolean() diff --git a/apps/api/src/app/order/update-order.dto.ts b/apps/api/src/app/order/update-order.dto.ts index a8c33c40e..9dfe52e8d 100644 --- a/apps/api/src/app/order/update-order.dto.ts +++ b/apps/api/src/app/order/update-order.dto.ts @@ -13,6 +13,7 @@ import { IsISO8601, IsNumber, IsOptional, + IsPositive, IsString } from 'class-validator'; import { isString } from 'lodash'; @@ -53,6 +54,7 @@ export class UpdateOrderDto { id: string; @IsNumber() + @IsPositive() quantity: number; @IsString() @@ -66,5 +68,6 @@ export class UpdateOrderDto { type: Type; @IsNumber() + @IsPositive() unitPrice: number; }