mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[ACA-3611] Add parentFolderId variable to getNodeByPath() (#2174)
* Add parentFolderId variable to getNodeByPath() * update getNodeByPath() usage * fix * lint fix
This commit is contained in:
@@ -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]: {
|
||||
|
@@ -36,10 +36,10 @@ export class NodesApi extends RepoApi {
|
||||
super(username, password);
|
||||
}
|
||||
|
||||
async getNodeByPath(relativePath: string = '/'): Promise<NodeEntry | null> {
|
||||
async getNodeByPath(relativePath: string = '/', parentFolderId: string = '-my-'): Promise<NodeEntry | null> {
|
||||
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<void> {
|
||||
async deleteNodeByPath(path: string, permanent: boolean = true, parentFolderId?: string): Promise<void> {
|
||||
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);
|
||||
|
Reference in New Issue
Block a user