mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-16 02:36:19 +00:00
only update if tag is no there
This commit is contained in:
@ -67,20 +67,25 @@ export class TagModelService {
|
||||
try {
|
||||
const existingTag = await this.getTagByUuid(tag.uuid);
|
||||
|
||||
if (spaceModel) {
|
||||
await this.checkTagReuse(tag.tag, existingTag.product.uuid, spaceModel);
|
||||
} else {
|
||||
await this.checkTagReuse(
|
||||
tag.tag,
|
||||
existingTag.product.uuid,
|
||||
subspaceModel.spaceModel,
|
||||
);
|
||||
}
|
||||
if (tag.tag !== existingTag.tag) {
|
||||
if (spaceModel) {
|
||||
await this.checkTagReuse(
|
||||
tag.tag,
|
||||
existingTag.product.uuid,
|
||||
spaceModel,
|
||||
);
|
||||
} else {
|
||||
await this.checkTagReuse(
|
||||
tag.tag,
|
||||
existingTag.product.uuid,
|
||||
subspaceModel.spaceModel,
|
||||
);
|
||||
}
|
||||
|
||||
if (tag.tag) {
|
||||
existingTag.tag = tag.tag;
|
||||
if (tag.tag) {
|
||||
existingTag.tag = tag.tag;
|
||||
}
|
||||
}
|
||||
|
||||
return await queryRunner.manager.save(existingTag);
|
||||
} catch (error) {
|
||||
if (error instanceof HttpException) {
|
||||
@ -217,7 +222,10 @@ export class TagModelService {
|
||||
});
|
||||
|
||||
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) {
|
||||
if (error instanceof HttpException) {
|
||||
|
Reference in New Issue
Block a user