Optional Contact

This commit is contained in:
Vincent Alamelle 2023-05-04 14:58:43 +02:00
parent cabb4c6c05
commit e05824e025

View File

@ -1,6 +1,7 @@
import { import {
IsDate, IsDate,
IsNotEmpty, IsNotEmpty,
IsOptional,
ValidateNested, ValidateNested,
} from "class-validator"; } from "class-validator";
import { Contact, Document } from "."; import { Contact, Document } from ".";
@ -14,10 +15,12 @@ export default class Customer extends Resource {
public uid?: string; public uid?: string;
@Expose() @Expose()
@IsOptional({ groups : ["updateCustomer"]})
@IsNotEmpty({ groups: ["updateCustomer"], message: "Status is required" }) @IsNotEmpty({ groups: ["updateCustomer"], message: "Status is required" })
public status!: ECustomerStatus | string; public status!: ECustomerStatus | string;
@Expose() @Expose()
@IsOptional({ groups : ["updateCustomer"]})
@IsNotEmpty({ groups: ["createCustomer", "updateCustomer"], message: "Contact is required" }) @IsNotEmpty({ groups: ["createCustomer", "updateCustomer"], message: "Contact is required" })
@ValidateNested({ groups: ["createCustomer", "updateCustomer"] }) @ValidateNested({ groups: ["createCustomer", "updateCustomer"] })
@Type(() => Contact) @Type(() => Contact)