mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-11-26 16:54:54 +00:00
Merge pull request #222 from SyncrowIOT/bugfix/get-space-model
Bugfix/get space model
This commit is contained in:
@ -6,7 +6,6 @@ import { SubspaceEntity } from '@app/common/modules/space/entities';
|
|||||||
import { TagModel } from '../tag-model.entity';
|
import { TagModel } from '../tag-model.entity';
|
||||||
|
|
||||||
@Entity({ name: 'subspace-model' })
|
@Entity({ name: 'subspace-model' })
|
||||||
@Unique(['subspaceName', 'spaceModel'])
|
|
||||||
export class SubspaceModelEntity extends AbstractEntity<SubSpaceModelDto> {
|
export class SubspaceModelEntity extends AbstractEntity<SubSpaceModelDto> {
|
||||||
@Column({
|
@Column({
|
||||||
type: 'uuid',
|
type: 'uuid',
|
||||||
|
|||||||
@ -310,6 +310,7 @@ export class SubSpaceModelService {
|
|||||||
spaceModel: {
|
spaceModel: {
|
||||||
uuid: spaceModelUuid,
|
uuid: spaceModelUuid,
|
||||||
},
|
},
|
||||||
|
disabled: false,
|
||||||
...(excludeUuid && { uuid: Not(excludeUuid) }),
|
...(excludeUuid && { uuid: Not(excludeUuid) }),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@ -67,20 +67,25 @@ export class TagModelService {
|
|||||||
try {
|
try {
|
||||||
const existingTag = await this.getTagByUuid(tag.uuid);
|
const existingTag = await this.getTagByUuid(tag.uuid);
|
||||||
|
|
||||||
if (spaceModel) {
|
if (tag.tag !== existingTag.tag) {
|
||||||
await this.checkTagReuse(tag.tag, existingTag.product.uuid, spaceModel);
|
if (spaceModel) {
|
||||||
} else {
|
await this.checkTagReuse(
|
||||||
await this.checkTagReuse(
|
tag.tag,
|
||||||
tag.tag,
|
existingTag.product.uuid,
|
||||||
existingTag.product.uuid,
|
spaceModel,
|
||||||
subspaceModel.spaceModel,
|
);
|
||||||
);
|
} else {
|
||||||
}
|
await this.checkTagReuse(
|
||||||
|
tag.tag,
|
||||||
|
existingTag.product.uuid,
|
||||||
|
subspaceModel.spaceModel,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (tag.tag) {
|
if (tag.tag) {
|
||||||
existingTag.tag = tag.tag;
|
existingTag.tag = tag.tag;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return await queryRunner.manager.save(existingTag);
|
return await queryRunner.manager.save(existingTag);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error instanceof HttpException) {
|
if (error instanceof HttpException) {
|
||||||
@ -217,7 +222,10 @@ export class TagModelService {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (tagExists) {
|
if (tagExists) {
|
||||||
throw new HttpException(`Tag can't be reused`, HttpStatus.CONFLICT);
|
throw new HttpException(
|
||||||
|
`Tag ${tag} can't be reused`,
|
||||||
|
HttpStatus.CONFLICT,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error instanceof HttpException) {
|
if (error instanceof HttpException) {
|
||||||
|
|||||||
Reference in New Issue
Block a user