mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-10 23:27:31 +00:00
added validation for product allocations
This commit is contained in:
@ -45,11 +45,14 @@ 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'],
|
relations: ['devices', 'subspaces', 'productAllocations'],
|
||||||
});
|
});
|
||||||
|
|
||||||
const hasInvalidSpaces = spaces.some(
|
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) {
|
if (hasInvalidSpaces) {
|
||||||
|
Reference in New Issue
Block a user