Skip to content

Commit f2b9921

Browse files
committed
refactor(namespace-resources): update root API
1 parent 99614b2 commit f2b9921

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

src/namespace-resources/namespace-resources.service.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -412,9 +412,13 @@ export class NamespaceResourcesService {
412412
namespaceId,
413413
excludeResourceId,
414414
userId,
415-
true,
416415
);
417-
where.id = Not(In(resourceChildren.map((children) => children.id)));
416+
where.id = Not(
417+
In([
418+
excludeResourceId,
419+
...resourceChildren.map((children) => children.id),
420+
]),
421+
);
418422
}
419423
if (name) {
420424
where.name = Like(`%${name}%`);
@@ -437,7 +441,6 @@ export class NamespaceResourcesService {
437441
namespaceId: string,
438442
resourceId: string,
439443
userId: string,
440-
includeParent: boolean = false,
441444
): Promise<ResourceMetaDto[]> {
442445
const parents = await this.resourcesService.getParentResources(
443446
namespaceId,
@@ -448,9 +451,6 @@ export class NamespaceResourcesService {
448451
parents,
449452
userId,
450453
);
451-
if (includeParent) {
452-
return [parents[0], ...children];
453-
}
454454
return children;
455455
}
456456

src/namespaces/namespaces.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,13 +305,13 @@ export class NamespacesService {
305305

306306
async getRoot(namespaceId: string, userId: string) {
307307
const privateRoot = await this.getPrivateRoot(userId, namespaceId);
308-
const privateChildren = await this.resourceService.getSubResourcesByUser(
308+
const privateChildren = await this.resourceService.listChildren(
309309
namespaceId,
310310
privateRoot.id,
311311
userId,
312312
);
313313
const teamspaceRoot = await this.getTeamspaceRoot(namespaceId);
314-
const teamspaceChildren = await this.resourceService.getSubResourcesByUser(
314+
const teamspaceChildren = await this.resourceService.listChildren(
315315
namespaceId,
316316
teamspaceRoot.id,
317317
userId,

src/wizard/stream.service.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,6 @@ export class StreamService {
254254
tool.namespace_id,
255255
resource.id,
256256
user.id,
257-
false,
258257
);
259258
resource.child_ids = resources.map((r) => r.id);
260259
tool.visible_resources.push(

0 commit comments

Comments
 (0)