Fixed hard delete endpoint, updated common-ui

This commit is contained in:
Adina Țeudan 2021-08-14 15:42:34 +03:00
parent 053c3db3b9
commit afa6a5ae50
3 changed files with 31 additions and 24 deletions

View File

@ -87,9 +87,9 @@ export class EditDossierDeletedDocumentsComponent extends ListingComponent<FileL
this._loadingService.stop();
}
revert(p0) {}
revert() {}
save(p0) {}
save() {}
restore(files = this.entitiesService.selected) {
this._loadingService.loadWhile(this._restore(files));
@ -105,7 +105,7 @@ export class EditDossierDeletedDocumentsComponent extends ListingComponent<FileL
private async _hardDelete(files: FileListItem[]) {
const fileIds = files.map(f => f.fileId);
await this._fileManagementController.hardDeleteFile(fileIds, this.dossierWrapper.dossierId).toPromise();
await this._fileManagementController.hardDeleteFile(this.dossierWrapper.dossierId, fileIds).toPromise();
this._removeFromList(fileIds);
this.updateDossier.emit();
}

@ -1 +1 @@
Subproject commit 360ef9bd6c87ec2ebb22554253e9ce9390775f09
Subproject commit 89376a65544fcdfcab1d960fba0d9f580cddc1ca

View File

@ -325,31 +325,45 @@ export class FileManagementControllerService {
/**
* Hard deletes an uploaded file.
* None
* @param body fileId
* @param dossierId dossierId
* @param fileIds fileIds
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public hardDeleteFile(body: Array<string>, dossierId: string, observe?: 'body', reportProgress?: boolean): Observable<any>;
public hardDeleteFile(dossierId: string, fileIds: Array<string>, observe?: 'body', reportProgress?: boolean): Observable<any>;
public hardDeleteFile(
body: Array<string>,
dossierId: string,
fileIds: Array<string>,
observe?: 'response',
reportProgress?: boolean
): Observable<HttpResponse<any>>;
public hardDeleteFile(body: Array<string>, dossierId: string, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>;
public hardDeleteFile(body: Array<string>, dossierId: string, observe: any = 'body', reportProgress: boolean = false): Observable<any> {
if (body === null || body === undefined) {
throw new Error('Required parameter body was null or undefined when calling hardDeleteFile.');
}
public hardDeleteFile(
dossierId: string,
fileIds: Array<string>,
observe?: 'events',
reportProgress?: boolean
): Observable<HttpEvent<any>>;
public hardDeleteFile(
dossierId: string,
fileIds: Array<string>,
observe: any = 'body',
reportProgress: boolean = false
): Observable<any> {
if (dossierId === null || dossierId === undefined) {
throw new Error('Required parameter dossierId was null or undefined when calling hardDeleteFile.');
}
if (fileIds === null || fileIds === undefined) {
throw new Error('Required parameter fileIds was null or undefined when calling hardDeleteFile.');
}
let queryParameters = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() });
if (fileIds) {
fileIds.forEach(element => {
queryParameters = queryParameters.append('fileIds', <any>element);
});
}
let headers = this.defaultHeaders;
// authentication (RED-OAUTH) required
@ -366,15 +380,8 @@ export class FileManagementControllerService {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
// to determine the Content-Type header
const consumes: string[] = ['*/*'];
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
if (httpContentTypeSelected !== undefined) {
headers = headers.set('Content-Type', httpContentTypeSelected);
}
return this.httpClient.request<any>('delete', `${this.basePath}/delete/hard-delete/${encodeURIComponent(String(dossierId))}`, {
body: body,
params: queryParameters,
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,