added validation for product allocations

This commit is contained in:
hannathkadher
2025-03-10 15:20:15 +04:00
parent f6d47d0e39
commit b9f0987bb0

View File

@ -45,11 +45,14 @@ export class ValidationService {
await this.communityService.validateProject(projectUuid);
const spaces = await this.spaceRepository.find({
where: { uuid: In(spacesUuids), disabled: false },
relations: ['devices', 'subspaces'],
relations: ['devices', 'subspaces', 'productAllocations'],
});
const hasInvalidSpaces = spaces.some(
(space) => space.devices.length > 0 || space.subspaces.length > 0,
(space) =>
space.devices.length > 0 ||
space.subspaces.length > 0 ||
space.productAllocations.length > 0,
);
if (hasInvalidSpaces) {