used bulk api for both requests(toggle one file or bulk files)

This commit is contained in:
Valentin Mihai 2022-02-07 13:43:34 +02:00
parent fb3cc7fc5b
commit f464c5e1fe
3 changed files with 3 additions and 11 deletions

View File

@ -88,7 +88,7 @@ export class BulkActionsService {
async toggleAutomaticAnalysis(files: File[], excluded?: boolean) {
this._loadingService.start();
const fileIds = files.map(file => file.fileId);
await firstValueFrom(this._reanalysisService.toggleAutomaticAnalysisBulk(files[0].dossierId, fileIds, excluded));
await firstValueFrom(this._reanalysisService.toggleAutomaticAnalysis(files[0].dossierId, fileIds, excluded));
this._loadingService.stop();
}

View File

@ -326,7 +326,7 @@ export class FileActionsComponent extends AutoUnsubscribe implements OnDestroy,
await firstValueFrom(
this._reanalysisService.toggleAutomaticAnalysis(
this.file.dossierId,
this.file.fileId,
[this.file.fileId],
!this.file.excludedFromAutomaticAnalysis,
),
);

View File

@ -53,15 +53,7 @@ export class ReanalysisService extends GenericService<unknown> {
}
@Validate()
toggleAutomaticAnalysis(@RequiredParam() dossierId: string, @RequiredParam() fileId: string, excluded?: boolean) {
const queryParams: QueryParam[] = [{ key: 'excluded', value: !!excluded }];
return this._post({}, `toggle-automatic-analysis/${dossierId}/${fileId}`, queryParams).pipe(
switchMap(() => this._filesService.loadAll(dossierId)),
);
}
@Validate()
toggleAutomaticAnalysisBulk(@RequiredParam() dossierId: string, @RequiredParam() fileIds: string[], excluded?: boolean) {
toggleAutomaticAnalysis(@RequiredParam() dossierId: string, @RequiredParam() fileIds: string[], excluded?: boolean) {
const queryParams: QueryParam[] = [{ key: 'excluded', value: !!excluded }];
return this._post(fileIds, 'toggle-automatic-analysis/bulk', queryParams).pipe(
switchMap(() => this._filesService.loadAll(dossierId)),