mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-11-26 11:34:53 +00:00
fix space
This commit is contained in:
@ -212,6 +212,7 @@ export class SpaceService {
|
||||
{ subspaceTagsDisabled: false },
|
||||
)
|
||||
.leftJoinAndSelect('subspaceTags.product', 'subspaceTagProduct')
|
||||
.leftJoinAndSelect('space.spaceModel', 'spaceModel')
|
||||
.where('space.community_id = :communityUuid', { communityUuid })
|
||||
.andWhere('space.spaceName != :orphanSpaceName', {
|
||||
orphanSpaceName: ORPHAN_SPACE_NAME,
|
||||
@ -286,6 +287,7 @@ export class SpaceService {
|
||||
.andWhere('space.spaceName != :orphanSpaceName', {
|
||||
orphanSpaceName: ORPHAN_SPACE_NAME,
|
||||
})
|
||||
.andWhere('space.uuid = :spaceUuid', { spaceUuid })
|
||||
.andWhere('space.disabled = :disabled', { disabled: false });
|
||||
|
||||
const space = await queryBuilder.getOne();
|
||||
@ -362,7 +364,7 @@ export class SpaceService {
|
||||
updateSpaceDto: UpdateSpaceDto,
|
||||
): Promise<BaseResponseDto> {
|
||||
const { communityUuid, spaceUuid, projectUuid } = params;
|
||||
|
||||
|
||||
const queryRunner = this.dataSource.createQueryRunner();
|
||||
|
||||
try {
|
||||
@ -584,7 +586,11 @@ export class SpaceService {
|
||||
addSpaceDto: AddSpaceDto,
|
||||
spaceModelUuid?: string,
|
||||
) {
|
||||
if (spaceModelUuid && (addSpaceDto.tags || addSpaceDto.subspaces)) {
|
||||
const hasTagsOrSubspaces =
|
||||
(addSpaceDto.tags && addSpaceDto.tags.length > 0) ||
|
||||
(addSpaceDto.subspaces && addSpaceDto.subspaces.length > 0);
|
||||
|
||||
if (spaceModelUuid && hasTagsOrSubspaces) {
|
||||
throw new HttpException(
|
||||
'For space creation choose either space model or products and subspace',
|
||||
HttpStatus.CONFLICT,
|
||||
|
||||
Reference in New Issue
Block a user