From 97e88e1ce01b78249d583b17b422bd05e777aa54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iulia=20Burc=C4=83?= Date: Mon, 14 Jun 2021 10:21:11 +0300 Subject: [PATCH] [ACA-3611] Add parentFolderId variable to getNodeByPath() (#2174) * Add parentFolderId variable to getNodeByPath() * update getNodeByPath() usage * fix * lint fix --- .../utilities/repo-client/apis/favorites/favorites-api.ts | 4 ++-- .../src/utilities/repo-client/apis/nodes/nodes-api.ts | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/projects/aca-testing-shared/src/utilities/repo-client/apis/favorites/favorites-api.ts b/projects/aca-testing-shared/src/utilities/repo-client/apis/favorites/favorites-api.ts index 93467564b..728efd7e9 100755 --- a/projects/aca-testing-shared/src/utilities/repo-client/apis/favorites/favorites-api.ts +++ b/projects/aca-testing-shared/src/utilities/repo-client/apis/favorites/favorites-api.ts @@ -37,9 +37,9 @@ export class FavoritesApi extends RepoApi { super(username, password); } - async addFavorite(api: RepoClient, nodeType: string, name: string) { + async addFavorite(api: RepoClient, nodeType: string, name: string, parentFolderId?: string) { try { - const nodeId = (await api.nodes.getNodeByPath(name)).entry.id; + const nodeId = (await api.nodes.getNodeByPath(name, parentFolderId)).entry.id; const data = { target: { [nodeType]: { diff --git a/projects/aca-testing-shared/src/utilities/repo-client/apis/nodes/nodes-api.ts b/projects/aca-testing-shared/src/utilities/repo-client/apis/nodes/nodes-api.ts index f9b57f15b..f1c912976 100755 --- a/projects/aca-testing-shared/src/utilities/repo-client/apis/nodes/nodes-api.ts +++ b/projects/aca-testing-shared/src/utilities/repo-client/apis/nodes/nodes-api.ts @@ -36,10 +36,10 @@ export class NodesApi extends RepoApi { super(username, password); } - async getNodeByPath(relativePath: string = '/'): Promise { + async getNodeByPath(relativePath: string = '/', parentFolderId: string = '-my-'): Promise { try { await this.apiAuth(); - return await this.nodesApi.getNode('-my-', { relativePath }); + return await this.nodesApi.getNode(parentFolderId, { relativePath }); } catch (error) { this.handleError(`${this.constructor.name} ${this.getNodeByPath.name}`, error); return null; @@ -155,9 +155,9 @@ export class NodesApi extends RepoApi { } } - async deleteNodeByPath(path: string, permanent: boolean = true): Promise { + async deleteNodeByPath(path: string, permanent: boolean = true, parentFolderId?: string): Promise { try { - const id = (await this.getNodeByPath(path)).entry.id; + const id = (await this.getNodeByPath(path, parentFolderId)).entry.id; await this.deleteNodeById(id, permanent); } catch (error) { this.handleError(`${this.constructor.name} ${this.deleteNodeByPath.name}`, error);