mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-11-27 03:04:54 +00:00
Merge branch 'dev' of https://github.com/SyncrowIOT/backend into feat/fix-propagation
This commit is contained in:
@ -170,10 +170,10 @@ export class ValidationService {
|
||||
where: { uuid: spaceModelUuid },
|
||||
relations: [
|
||||
'subspaceModels',
|
||||
'subspaceModels.tags',
|
||||
'tags',
|
||||
'subspaceModels.tags.product',
|
||||
'tags.product',
|
||||
'subspaceModels.productAllocations',
|
||||
'subspaceModels.productAllocations.tags',
|
||||
'productAllocations.product',
|
||||
'productAllocations.tags',
|
||||
],
|
||||
});
|
||||
|
||||
|
||||
@ -110,7 +110,7 @@ export class SpaceService {
|
||||
this.validateUniqueTags(allTags);
|
||||
if (spaceModelUuid) {
|
||||
const hasDependencies = subspaces?.length > 0 || tags?.length > 0;
|
||||
if (!hasDependencies && !newSpace.spaceModel) {
|
||||
if (!hasDependencies) {
|
||||
await this.spaceModelService.linkToSpace(
|
||||
newSpace,
|
||||
spaceModel,
|
||||
@ -246,10 +246,11 @@ export class SpaceService {
|
||||
const spaces = await queryBuilder.getMany();
|
||||
|
||||
const transformedSpaces = spaces.map(this.transformSpace);
|
||||
const spaceHierarchy = this.buildSpaceHierarchy(transformedSpaces);
|
||||
|
||||
return new SuccessResponseDto({
|
||||
message: `Spaces in community ${communityUuid} successfully fetched in hierarchy`,
|
||||
data: onlyWithDevices ? spaces : transformedSpaces,
|
||||
data: onlyWithDevices ? spaces : spaceHierarchy,
|
||||
statusCode: HttpStatus.OK,
|
||||
});
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user