From 6965fe4fd32488573d3c2e2b5cdb1da2593f197d Mon Sep 17 00:00:00 2001 From: Thomas <4159106+dtslvr@users.noreply.github.com> Date: Tue, 24 Oct 2023 20:22:43 +0200 Subject: [PATCH] Expect number >= 0 for fee --- apps/api/src/app/order/create-order.dto.ts | 4 +++- apps/api/src/app/order/update-order.dto.ts | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/api/src/app/order/create-order.dto.ts b/apps/api/src/app/order/create-order.dto.ts index d4beff752..3eafa704f 100644 --- a/apps/api/src/app/order/create-order.dto.ts +++ b/apps/api/src/app/order/create-order.dto.ts @@ -14,7 +14,8 @@ import { IsNumber, IsOptional, IsPositive, - IsString + IsString, + Min } from 'class-validator'; import { isString } from 'lodash'; @@ -49,6 +50,7 @@ export class CreateOrderDto { date: string; @IsNumber() + @Min(0) fee: number; @IsNumber() diff --git a/apps/api/src/app/order/update-order.dto.ts b/apps/api/src/app/order/update-order.dto.ts index 9dfe52e8d..9d968aa86 100644 --- a/apps/api/src/app/order/update-order.dto.ts +++ b/apps/api/src/app/order/update-order.dto.ts @@ -14,7 +14,8 @@ import { IsNumber, IsOptional, IsPositive, - IsString + IsString, + Min } from 'class-validator'; import { isString } from 'lodash'; @@ -48,6 +49,7 @@ export class UpdateOrderDto { date: string; @IsNumber() + @Min(0) fee: number; @IsString()