mirror of
https://github.com/wgh136/nysoure.git
synced 2025-09-27 12:17:24 +00:00
Initial commit
This commit is contained in:
21
server/model/tag.go
Normal file
21
server/model/tag.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package model
|
||||
|
||||
import "gorm.io/gorm"
|
||||
|
||||
type Tag struct {
|
||||
gorm.Model
|
||||
Name string `gorm:"unique"`
|
||||
Resources []Resource `gorm:"many2many:resource_tags;"`
|
||||
}
|
||||
|
||||
type TagView struct {
|
||||
ID uint `json:"id"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
func (t *Tag) ToView() *TagView {
|
||||
return &TagView{
|
||||
ID: t.ID,
|
||||
Name: t.Name,
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user