Improve tag alias.

This commit is contained in:
2025-05-30 16:18:38 +08:00
parent 5ef2816f98
commit 62daa692c8
2 changed files with 8 additions and 1 deletions

View File

@@ -64,6 +64,13 @@ func GetTagByName(name string) (model.Tag, error) {
}
func SetTagInfo(id uint, description string, aliasOf *uint, tagType string) error {
old, err := GetTagByID(id)
if err != nil {
return err
}
if aliasOf != nil && len(old.Aliases) > 0 {
return model.NewRequestError("Tag already has aliases, cannot set alias_of")
}
t := model.Tag{Model: gorm.Model{
ID: id,
}, Description: description, Type: tagType, AliasOf: aliasOf}