fix issues

This commit is contained in:
hannathkadher
2025-03-12 01:36:10 +04:00
parent 67a78dbdfd
commit 1ce2f3c3cc
7 changed files with 122 additions and 78 deletions

View File

@ -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(