From e05824e025fc618a6c7aa00a19cb62dd27fa7a5d Mon Sep 17 00:00:00 2001 From: Vincent Alamelle Date: Thu, 4 May 2023 14:58:43 +0200 Subject: [PATCH] Optional Contact --- src/Customer/Customer.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Customer/Customer.ts b/src/Customer/Customer.ts index 6e25c53..95603b8 100644 --- a/src/Customer/Customer.ts +++ b/src/Customer/Customer.ts @@ -1,6 +1,7 @@ import { IsDate, IsNotEmpty, + IsOptional, ValidateNested, } from "class-validator"; import { Contact, Document } from "."; @@ -14,10 +15,12 @@ export default class Customer extends Resource { public uid?: string; @Expose() + @IsOptional({ groups : ["updateCustomer"]}) @IsNotEmpty({ groups: ["updateCustomer"], message: "Status is required" }) public status!: ECustomerStatus | string; @Expose() + @IsOptional({ groups : ["updateCustomer"]}) @IsNotEmpty({ groups: ["createCustomer", "updateCustomer"], message: "Contact is required" }) @ValidateNested({ groups: ["createCustomer", "updateCustomer"] }) @Type(() => Contact)