mirror of
https://github.com/wgh136/nysoure.git
synced 2025-09-27 12:17:24 +00:00
Improve tag alias.
This commit is contained in:
@@ -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}
|
||||
|
Reference in New Issue
Block a user