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