Merge pull request #305 from SyncrowIOT:bugfix/added-validation-for-space-model

added validation for space model
This commit is contained in:
hannathkadher
2025-03-11 22:12:39 +04:00
committed by GitHub
@@ -45,14 +45,15 @@ export class ValidationService {
await this.communityService.validateProject(projectUuid); await this.communityService.validateProject(projectUuid);
const spaces = await this.spaceRepository.find({ const spaces = await this.spaceRepository.find({
where: { uuid: In(spacesUuids), disabled: false }, where: { uuid: In(spacesUuids), disabled: false },
relations: ['devices', 'subspaces', 'productAllocations'], relations: ['devices', 'subspaces', 'productAllocations', 'spaceModel'],
}); });
const hasInvalidSpaces = spaces.some( const hasInvalidSpaces = spaces.some(
(space) => (space) =>
space.devices.length > 0 || space.devices.length > 0 ||
space.subspaces.length > 0 || space.subspaces.length > 0 ||
space.productAllocations.length > 0, space.productAllocations.length > 0 ||
space.spaceModel,
); );
if (hasInvalidSpaces) { if (hasInvalidSpaces) {