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 {
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)