mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-17 03:05:13 +00:00
Revamp/space management (#409)
* task: add getCommunitiesV2 * task: update getOneSpace API to match revamp structure * refactor: implement modifications to pace management APIs * refactor: remove space link
This commit is contained in:
@ -16,7 +16,7 @@ import {
|
||||
Inject,
|
||||
Injectable,
|
||||
} from '@nestjs/common';
|
||||
import { In } from 'typeorm';
|
||||
import { In, QueryRunner } from 'typeorm';
|
||||
import { CommunityService } from '../../community/services';
|
||||
import { ProjectService } from '../../project/services';
|
||||
import { ProjectParam } from '../dtos';
|
||||
@ -69,12 +69,17 @@ export class ValidationService {
|
||||
async validateCommunityAndProject(
|
||||
communityUuid: string,
|
||||
projectUuid: string,
|
||||
queryRunner?: QueryRunner,
|
||||
) {
|
||||
const project = await this.projectService.findOne(projectUuid);
|
||||
const community = await this.communityService.getCommunityById({
|
||||
communityUuid,
|
||||
projectUuid,
|
||||
});
|
||||
const project = await this.projectService.findOne(projectUuid, queryRunner);
|
||||
|
||||
const community = await this.communityService.getCommunityById(
|
||||
{
|
||||
communityUuid,
|
||||
projectUuid,
|
||||
},
|
||||
queryRunner,
|
||||
);
|
||||
|
||||
return { community: community.data, project: project };
|
||||
}
|
||||
@ -170,8 +175,14 @@ export class ValidationService {
|
||||
return space;
|
||||
}
|
||||
|
||||
async validateSpaceModel(spaceModelUuid: string): Promise<SpaceModelEntity> {
|
||||
const queryBuilder = this.spaceModelRepository
|
||||
async validateSpaceModel(
|
||||
spaceModelUuid: string,
|
||||
queryRunner?: QueryRunner,
|
||||
): Promise<SpaceModelEntity> {
|
||||
const queryBuilder = (
|
||||
queryRunner.manager.getRepository(SpaceModelEntity) ||
|
||||
this.spaceModelRepository
|
||||
)
|
||||
.createQueryBuilder('spaceModel')
|
||||
.leftJoinAndSelect(
|
||||
'spaceModel.subspaceModels',
|
||||
|
Reference in New Issue
Block a user