From c0b8e0d779edc5a37f4855892fd1051ed919b5b9 Mon Sep 17 00:00:00 2001 From: hannathkadher Date: Thu, 21 Nov 2024 08:20:33 +0400 Subject: [PATCH] merged with space-product --- libs/common/src/modules/space/entities/space.entity.ts | 1 + src/space/services/space.service.ts | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/libs/common/src/modules/space/entities/space.entity.ts b/libs/common/src/modules/space/entities/space.entity.ts index 16d5786..38d4c5e 100644 --- a/libs/common/src/modules/space/entities/space.entity.ts +++ b/libs/common/src/modules/space/entities/space.entity.ts @@ -87,6 +87,7 @@ export class SpaceEntity extends AbstractEntity { type: 'text', }) public icon: string; + @OneToMany(() => SpaceProductEntity, (spaceProduct) => spaceProduct.space) spaceProducts: SpaceProductEntity[]; diff --git a/src/space/services/space.service.ts b/src/space/services/space.service.ts index f8dcf71..7e22f40 100644 --- a/src/space/services/space.service.ts +++ b/src/space/services/space.service.ts @@ -74,7 +74,12 @@ export class SpaceService { // Get all spaces related to the community, including the parent-child relations const spaces = await this.spaceRepository.find({ where: { community: { uuid: communityUuid } }, - relations: ['parent', 'children', 'incomingConnections'], // Include parent and children relations + relations: [ + 'parent', + 'children', + 'incomingConnections', + 'spaceProducts', + ], // Include parent and children relations }); // Organize spaces into a hierarchical structure