Add tag description.

This commit is contained in:
2025-05-24 20:38:05 +08:00
parent 73815560b4
commit c55dc709e0
8 changed files with 231 additions and 20 deletions

View File

@@ -4,18 +4,21 @@ import "gorm.io/gorm"
type Tag struct {
gorm.Model
Name string `gorm:"unique"`
Resources []Resource `gorm:"many2many:resource_tags;"`
Name string `gorm:"unique"`
Description string
Resources []Resource `gorm:"many2many:resource_tags;"`
}
type TagView struct {
ID uint `json:"id"`
Name string `json:"name"`
ID uint `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
}
func (t *Tag) ToView() *TagView {
return &TagView{
ID: t.ID,
Name: t.Name,
ID: t.ID,
Name: t.Name,
Description: t.Description,
}
}