mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-16 18:56:22 +00:00
fix issues
This commit is contained in:
@ -177,17 +177,36 @@ export class ValidationService {
|
||||
}
|
||||
|
||||
async validateSpaceModel(spaceModelUuid: string): Promise<SpaceModelEntity> {
|
||||
const spaceModel = await this.spaceModelRepository.findOne({
|
||||
where: { uuid: spaceModelUuid },
|
||||
relations: [
|
||||
const queryBuilder = this.spaceModelRepository
|
||||
.createQueryBuilder('spaceModel')
|
||||
.leftJoinAndSelect(
|
||||
'spaceModel.subspaceModels',
|
||||
'subspaceModels',
|
||||
'subspaceModels.disabled = :disabled',
|
||||
{ disabled: false },
|
||||
)
|
||||
.leftJoinAndSelect(
|
||||
'subspaceModels.productAllocations',
|
||||
'subspaceModels.productAllocations.tags',
|
||||
'subspaceModels.productAllocations.product',
|
||||
'subspaceProductAllocations',
|
||||
)
|
||||
.leftJoinAndSelect(
|
||||
'subspaceProductAllocations.tags',
|
||||
'subspaceAllocationTags',
|
||||
)
|
||||
.leftJoinAndSelect(
|
||||
'subspaceProductAllocations.product',
|
||||
'subspaceAllocationProduct',
|
||||
)
|
||||
.leftJoinAndSelect('spaceModel.productAllocations', 'productAllocations')
|
||||
.leftJoinAndSelect(
|
||||
'productAllocations.product',
|
||||
'productAllocations.tags',
|
||||
],
|
||||
});
|
||||
'productAllocationProduct',
|
||||
)
|
||||
.leftJoinAndSelect('productAllocations.tags', 'productAllocationTags')
|
||||
.andWhere('spaceModel.disabled = :disabled', { disabled: false })
|
||||
.where('spaceModel.uuid = :uuid', { uuid: spaceModelUuid });
|
||||
|
||||
const spaceModel = await queryBuilder.getOne();
|
||||
|
||||
if (!spaceModel) {
|
||||
throw new HttpException(
|
||||
|
Reference in New Issue
Block a user