mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-17 03:05:13 +00:00
Merge pull request #279 from SyncrowIOT/bugfix/link-space-model
This commit is contained in:
@ -12,7 +12,7 @@ export class LinkSpacesToModelDto {
|
|||||||
})
|
})
|
||||||
@IsArray()
|
@IsArray()
|
||||||
@ArrayNotEmpty()
|
@ArrayNotEmpty()
|
||||||
@IsUUID()
|
@IsUUID('4', { each: true })
|
||||||
spaceUuids: string[];
|
spaceUuids: string[];
|
||||||
|
|
||||||
@ApiProperty({
|
@ApiProperty({
|
||||||
|
@ -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({
|
||||||
|
Reference in New Issue
Block a user