54 lines
1.2 KiB
TypeScript
54 lines
1.2 KiB
TypeScript
import {
|
|
IsDate, IsNotEmpty,
|
|
} from "class-validator";
|
|
import Customer from ".";
|
|
import DocumentHistory from "./DocumentHistory";
|
|
import DocumentType from "./DocumentType";
|
|
import File from "./File";
|
|
import OfficeFolder from "./OfficeFolder";
|
|
import Resource from "../Resource";
|
|
import { Expose, Type } from "class-transformer";
|
|
|
|
export default class Document extends Resource {
|
|
@Expose()
|
|
@IsNotEmpty({ groups: ["createFile"], message: "UID is required" })
|
|
public uid?: string;
|
|
|
|
@Expose()
|
|
public document_status!: EDocumentStatus | string;
|
|
|
|
@Expose()
|
|
@Type(() => DocumentType)
|
|
public document_type?: DocumentType;
|
|
|
|
@Expose()
|
|
@Type(() => OfficeFolder)
|
|
public folder?: OfficeFolder;
|
|
|
|
@Expose()
|
|
@Type(() => Customer)
|
|
public depositor?: Customer;
|
|
|
|
@Expose()
|
|
@IsDate()
|
|
public created_at: Date | null = null;
|
|
|
|
@Expose()
|
|
@IsDate()
|
|
public updated_at: Date | null = null;
|
|
|
|
@Expose()
|
|
@Type(() => File)
|
|
public files?: File[];
|
|
|
|
@Expose()
|
|
@Type(() => DocumentHistory)
|
|
public document_history?: DocumentHistory[];
|
|
}
|
|
export enum EDocumentStatus {
|
|
ASKED = "ASKED",
|
|
DEPOSITED = "DEPOSITED",
|
|
VALIDATED = "VALIDATED",
|
|
REFUSED = "REFUSED",
|
|
}
|