remove dossier template id from file

This commit is contained in:
Dan Percic 2021-10-01 13:19:18 +03:00
parent 55c0d37628
commit 4ba75fea07
4 changed files with 7 additions and 16 deletions

View File

@ -42,7 +42,6 @@ export class File implements IFile, IListable {
readonly uploader?: string;
readonly excludedPages?: number[];
readonly hasSuggestions: boolean;
readonly dossierTemplateId?: string;
primaryAttribute: string;
lastOpened: boolean;
@ -95,7 +94,6 @@ export class File implements IFile, IListable {
this.uploader = file.uploader;
this.excludedPages = file.excludedPages;
this.hasSuggestions = !!file.hasSuggestions;
this.dossierTemplateId = file.dossierTemplateId;
this.statusSort = StatusSorter[this.status];
if (this.lastUpdated && this.lastOCRTime) {

View File

@ -34,10 +34,10 @@ export class DocumentInfoComponent extends AutoUnsubscribe implements OnInit {
}
ngOnInit(): void {
this.fileAttributesConfig = this._fileAttributesService.getFileAttributeConfig(this.file.dossierTemplateId);
this.fileAttributesConfig = this._fileAttributesService.getFileAttributeConfig(this.dossier.dossierTemplateId);
this.addSubscription = this._appStateService.dossierTemplateChanged$.subscribe(() => {
this.fileAttributesConfig = this._fileAttributesService.getFileAttributeConfig(this.file.dossierTemplateId);
this.fileAttributesConfig = this._fileAttributesService.getFileAttributeConfig(this.dossier.dossierTemplateId);
});
}

View File

@ -212,7 +212,7 @@ export class AppStateService {
return this.getDossierById(dossierId)?.files.find(file => file.fileId === fileId);
}
async loadAllDossiers(emitEvents: boolean = true) {
async loadAllDossiers(emitEvents = true) {
const dossiers = await this._dossiersService.get().toPromise();
if (!dossiers) {
return;
@ -237,14 +237,12 @@ export class AppStateService {
return null;
}
const oldProcessedDate = this.activeFile.lastProcessed;
const dossierTemplateId = this.activeFile.dossierTemplateId;
const iFile = await this._filesService.get(this.activeDossierId, this.activeFileId).toPromise();
iFile.dossierTemplateId = dossierTemplateId;
const activeFile = new File(
iFile,
this._userService.getNameForId(iFile.currentReviewer),
this._fileAttributesService.getFileAttributeConfig(iFile.dossierTemplateId)
this._fileAttributesService.getFileAttributeConfig(this.activeDossier?.dossierTemplateId)
);
const files = this.activeDossier?.files.map(file => (file.fileId === activeFile.fileId ? activeFile : file));
const newDossier = new Dossier(this.activeDossier, files);
@ -687,7 +685,6 @@ export class AppStateService {
for (const iFile of iFiles) {
let found = false;
iFile.dossierTemplateId = dossier.dossierTemplateId;
for (const oldFile of oldFiles) {
if (oldFile.fileId === iFile.fileId) {
@ -695,7 +692,7 @@ export class AppStateService {
const file = new File(
iFile,
this._userService.getNameForId(iFile.currentReviewer),
this._fileAttributesService.getFileAttributeConfig(iFile.dossierTemplateId)
this._fileAttributesService.getFileAttributeConfig(dossier.dossierTemplateId)
);
file.lastOpened = file.fileId === this._userPreferenceService.getLastOpenedFileForDossier(dossier.id);
if (JSON.stringify(oldFile) !== JSON.stringify(file)) {
@ -713,7 +710,7 @@ export class AppStateService {
const file = new File(
iFile,
this._userService.getNameForId(iFile.currentReviewer),
this._fileAttributesService.getFileAttributeConfig(iFile.dossierTemplateId)
this._fileAttributesService.getFileAttributeConfig(dossier.dossierTemplateId)
);
fileChangedEvent.push(file);
}
@ -724,7 +721,7 @@ export class AppStateService {
new File(
iFile,
this._userService.getNameForId(iFile.currentReviewer),
this._fileAttributesService.getFileAttributeConfig(iFile.dossierTemplateId)
this._fileAttributesService.getFileAttributeConfig(dossier.dossierTemplateId)
)
);

View File

@ -51,10 +51,6 @@ export interface IFile {
* The ID of the dossier the file belongs to.
*/
readonly dossierId: string;
/**
* The dossierTemplateId for this file.
*/
dossierTemplateId?: string;
/**
* Shows if the file was excluded from analysis.
*/