lecoffre-ressources/src/Customer/DocumentType.ts
2023-05-03 11:56:13 +02:00

45 lines
1.4 KiB
TypeScript

import { IsNotEmpty, IsDate, IsOptional, ValidateNested } from "class-validator";
import DeedHasDocumentType from "./DeedHasDocumentType";
import Document from "./Document";
import DeedTypeHasDocumentType from "./DeedTypeHasDocumentType";
import Office from "./Office";
import Resource from "../Resource";
import { Type } from "class-transformer";
export default class DocumentType extends Resource {
@IsNotEmpty({ groups: ["createDocument" , "createDeedType", "updateFolder"] ,message: "UID is required" })
public uid?: string;
@IsNotEmpty({ groups: ["createDocumentType"], message: "Name is required" })
public name!: string;
@IsNotEmpty({ groups: ["createDocumentType"], message: "Public description is required" })
public public_description!: string;
@IsOptional({ groups: ["createDocumentType"] })
public private_description: string | null = null;
@IsDate()
public archived_at: Date | null = null;
@IsNotEmpty({ groups: ["createDocumentType"], message: "Office is required" })
@ValidateNested({ groups: ["createDocumentType"] })
@Type(() => Office)
public office!: Office;
@IsDate()
public created_at: Date | null = null;
@IsDate()
public updated_at: Date | null = null;
@Type(() => Document)
public documents?: Document[];
@Type(() => DeedHasDocumentType)
public deed_has_document_types?: DeedHasDocumentType[];
@Type(() => DeedTypeHasDocumentType)
public deed_type_has_document_types?: DeedTypeHasDocumentType[];
}