Browse Source

relates to #2375 - quantity and unitPrice should be positive

pull/2496/head
Rafael Claudio 2 years ago
parent
commit
2108cbc3ab
  1. 3
      apps/api/src/app/order/create-order.dto.ts
  2. 3
      apps/api/src/app/order/update-order.dto.ts

3
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()

3
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;
}

Loading…
Cancel
Save