red-ui/libs/red-domain/src/lib/trash/trash-file.model.ts
2022-07-11 22:10:30 +03:00

60 lines
1.7 KiB
TypeScript

import { TrashItem } from './trash.item';
import { File, IFile } from '../files';
import { FileAttributes } from '../file-attributes';
export class TrashFile extends TrashItem implements Partial<IFile> {
readonly type = 'file';
readonly icon = 'iqser:document';
readonly dossierId: string;
readonly fileId: string;
readonly filename: string;
readonly assignee?: string;
readonly numberOfPages: number;
readonly excludedPages: number[];
readonly lastOCRTime?: string;
readonly fileAttributes: FileAttributes;
readonly isError: boolean;
readonly isInitialProcessing: boolean;
constructor(
file: File,
readonly dossierTemplateId: string,
protected readonly _retentionHours: number,
readonly hasRestoreRights: boolean,
readonly hasHardDeleteRights: boolean,
readonly ownerName: string,
readonly fileDossierName: string,
) {
super(_retentionHours, file.softDeletedTime, hasRestoreRights, hasHardDeleteRights);
this.fileId = file.fileId;
this.dossierId = file.dossierId;
this.filename = file.filename;
this.assignee = file.assignee;
this.numberOfPages = file.numberOfPages || 0;
this.excludedPages = file.excludedPages || [];
this.lastOCRTime = file.lastOCRTime;
this.fileAttributes = file.fileAttributes;
this.isError = file.isError;
this.isInitialProcessing = file.isInitialProcessing;
}
get id(): string {
return this.fileId;
}
get searchKey(): string {
return this.filename;
}
get name(): string {
return this.filename;
}
get ownerId(): string | undefined {
return this.assignee;
}
}