Add Quick Add Tag functionality and improve tag management in Edit and Publish pages

This commit is contained in:
2025-05-31 12:43:08 +08:00
parent 37a3d0e459
commit d597d62c1c
8 changed files with 221 additions and 8 deletions

View File

@@ -16,6 +16,15 @@ func CreateTag(tag string) (model.Tag, error) {
return t, nil
}
func CreateTagWithType(tag string, tagType string) (model.Tag, error) {
// Create a new tag with a specific type in the database
t := model.Tag{Name: tag, Type: tagType}
if err := db.Create(&t).Error; err != nil {
return model.Tag{}, err
}
return t, nil
}
func SearchTag(keyword string, mainTag bool) ([]model.Tag, error) {
// Search for a tag by its name in the database
var t []model.Tag