From 728081b1bd6024e3fd684baa368ccf38c275ad85 Mon Sep 17 00:00:00 2001 From: Tomasz Nastaly Date: Mon, 10 Jun 2024 12:01:35 +0200 Subject: [PATCH] [ACS-7689] Save holds methods --- .../legal-hold/services/legal-hold.service.ts | 21 +++++++++++++++++++ .../gs-core-rest-api/api/legal-hold.api.ts | 18 ++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/lib/content-services/src/lib/legal-hold/services/legal-hold.service.ts b/lib/content-services/src/lib/legal-hold/services/legal-hold.service.ts index d53d9867e2..a41f18fa9f 100644 --- a/lib/content-services/src/lib/legal-hold/services/legal-hold.service.ts +++ b/lib/content-services/src/lib/legal-hold/services/legal-hold.service.ts @@ -53,4 +53,25 @@ export class LegalHoldService { catchError((err) => throwError(err)) ); } + + /** + * Adds to hold to existing hold + * + * @param ids The list of manage hold Ids + * @param ids list of ids of holds to add to existing hold + * @returns List of assigned holds Hold[] + */ + saveHold(ids: string[], holdId: string): Observable { + return from(this.legalHoldApi.saveToExistingHolds(ids, holdId)).pipe( + map(({ list }) => + list?.entries?.map(({ entry }) => ({ + id: entry?.id, + name: entry?.name, + reason: entry?.reason, + description: entry?.description + })) + ), + catchError((err) => throwError(err)) + ); + } } diff --git a/lib/js-api/src/api/gs-core-rest-api/api/legal-hold.api.ts b/lib/js-api/src/api/gs-core-rest-api/api/legal-hold.api.ts index 9cb26cffb0..3a0f5a06eb 100644 --- a/lib/js-api/src/api/gs-core-rest-api/api/legal-hold.api.ts +++ b/lib/js-api/src/api/gs-core-rest-api/api/legal-hold.api.ts @@ -51,4 +51,22 @@ export class LegalHoldApi extends BaseApi { returnType: NodeChildAssociationPaging }); } + + /** + * Adds to existiing hold + * + * @param holdId The identifier of a hold. + * @param ids list of ids of holds to add to existing hold + * @returns Promise + */ + saveToExistingHolds(ids: string[], holdId: string): Promise { + throwIfNotDefined(holdId, 'holdId'); + + return this.post({ + path: '/holds/{holdId}/children', + pathParams: { holdId }, + bodyParam: ids, + returnType: NodeChildAssociationPaging + }); + } }