Merge pull request #279 from SyncrowIOT/bugfix/link-space-model

This commit is contained in:
hannathkadher
2025-03-04 12:48:54 +04:00
committed by GitHub
2 changed files with 1 additions and 15 deletions

View File

@ -12,7 +12,7 @@ export class LinkSpacesToModelDto {
}) })
@IsArray() @IsArray()
@ArrayNotEmpty() @ArrayNotEmpty()
@IsUUID() @IsUUID('4', { each: true })
spaceUuids: string[]; spaceUuids: string[];
@ApiProperty({ @ApiProperty({

View File

@ -337,13 +337,6 @@ export class SpaceModelService {
); );
} }
if (!spaceModel.productAllocations.length) {
throw new HttpException(
`Space Model ${params.spaceModelUuid} has no product allocations`,
HttpStatus.BAD_REQUEST,
);
}
const spaces = await this.spaceRepository.find({ const spaces = await this.spaceRepository.find({
where: { uuid: In(dto.spaceUuids), disabled: false }, where: { uuid: In(dto.spaceUuids), disabled: false },
relations: [ relations: [
@ -410,13 +403,6 @@ export class SpaceModelService {
); );
await this.spaceProductAllocationRepository.save(spaceProductAllocations); await this.spaceProductAllocationRepository.save(spaceProductAllocations);
if (!spaceModel.subspaceModels.length) {
throw new HttpException(
`Space Model ${spaceModel.uuid} has no subspaces`,
HttpStatus.BAD_REQUEST,
);
}
await Promise.all( await Promise.all(
spaceModel.subspaceModels.map(async (subspaceModel) => { spaceModel.subspaceModels.map(async (subspaceModel) => {
const subspace = this.subspaceRepository.create({ const subspace = this.subspaceRepository.create({