probo/models/collection.go
2023-11-20 14:14:09 +01:00

41 lines
627 B
Go

package models
import "encoding/json"
type Filter struct {
Tags []*Tag
}
type Collection struct {
Meta
Name string `json:"name"`
Filter *Filter `json:"filter"`
Quizzes []*Quiz `json:"quizzes" gorm:"many2many:collection_quizzes"`
}
func (c *Collection) String() string {
return c.Name
}
func (c *Collection) GetID() string {
return c.ID
}
func (c *Collection) SetID(id string) {
c.ID = id
}
func (c *Collection) GetHash() string {
return ""
}
func (c *Collection) Marshal() ([]byte, error) {
return json.Marshal(c)
}
func (c *Collection) Unmarshal(data []byte) error {
return json.Unmarshal(data, c)
}