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

@@ -51,7 +51,7 @@ export default function TaggedResourcesPage() {
}} /> }} />
} }
</div> </div>
{tag?.type && <h2 className={"text-base-content/60 ml-2 text-xl pl-2 mb-2"}>{tag.type}</h2>} {tag?.type && <h2 className={"text-base-content/60 ml-2 text-lg pl-2 mb-2"}>{tag.type}</h2>}
<div className={"px-3"}> <div className={"px-3"}>
{ {
(tag?.aliases ?? []).map((e) => { (tag?.aliases ?? []).map((e) => {

View File

@@ -64,6 +64,13 @@ func GetTagByName(name string) (model.Tag, error) {
} }
func SetTagInfo(id uint, description string, aliasOf *uint, tagType string) 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{ t := model.Tag{Model: gorm.Model{
ID: id, ID: id,
}, Description: description, Type: tagType, AliasOf: aliasOf} }, Description: description, Type: tagType, AliasOf: aliasOf}