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(); this._loadingService.stop();
} }
revert(p0) {} revert() {}
save(p0) {} save() {}
restore(files = this.entitiesService.selected) { restore(files = this.entitiesService.selected) {
this._loadingService.loadWhile(this._restore(files)); this._loadingService.loadWhile(this._restore(files));
@ -105,7 +105,7 @@ export class EditDossierDeletedDocumentsComponent extends ListingComponent<FileL
private async _hardDelete(files: FileListItem[]) { private async _hardDelete(files: FileListItem[]) {
const fileIds = files.map(f => f.fileId); 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._removeFromList(fileIds);
this.updateDossier.emit(); 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. * Hard deletes an uploaded file.
* None * None
* @param body fileId
* @param dossierId dossierId * @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 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. * @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( public hardDeleteFile(
body: Array<string>,
dossierId: string, dossierId: string,
fileIds: Array<string>,
observe?: 'response', observe?: 'response',
reportProgress?: boolean reportProgress?: boolean
): Observable<HttpResponse<any>>; ): Observable<HttpResponse<any>>;
public hardDeleteFile(
public hardDeleteFile(body: Array<string>, dossierId: string, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>; dossierId: string,
fileIds: Array<string>,
public hardDeleteFile(body: Array<string>, dossierId: string, observe: any = 'body', reportProgress: boolean = false): Observable<any> { observe?: 'events',
if (body === null || body === undefined) { reportProgress?: boolean
throw new Error('Required parameter body was null or undefined when calling hardDeleteFile.'); ): Observable<HttpEvent<any>>;
} public hardDeleteFile(
dossierId: string,
fileIds: Array<string>,
observe: any = 'body',
reportProgress: boolean = false
): Observable<any> {
if (dossierId === null || dossierId === undefined) { if (dossierId === null || dossierId === undefined) {
throw new Error('Required parameter dossierId was null or undefined when calling hardDeleteFile.'); 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; let headers = this.defaultHeaders;
// authentication (RED-OAUTH) required // authentication (RED-OAUTH) required
@ -366,15 +380,8 @@ export class FileManagementControllerService {
headers = headers.set('Accept', httpHeaderAcceptSelected); 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))}`, { return this.httpClient.request<any>('delete', `${this.basePath}/delete/hard-delete/${encodeURIComponent(String(dossierId))}`, {
body: body, params: queryParameters,
withCredentials: this.configuration.withCredentials, withCredentials: this.configuration.withCredentials,
headers: headers, headers: headers,
observe: observe, observe: observe,