41 lines
990 B
Go
41 lines
990 B
Go
package json
|
|
|
|
import "gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/temp_models/db"
|
|
|
|
type Macro struct {
|
|
Command string `json:"command"`
|
|
Name string `json:"name"`
|
|
Type string `json:"type"`
|
|
Img string `json:"img"`
|
|
ID string `json:"_id"`
|
|
Author string `json:"author"`
|
|
Scope string `json:"scope"`
|
|
Folder string `json:"folder"`
|
|
Sort int `json:"sort"`
|
|
Ownership map[string]int `json:"ownership,omitempty"`
|
|
Stats Stats `json:"_stats"`
|
|
// Flags any `json:"flags,omitempty"`
|
|
}
|
|
|
|
func (m *Macro) ToDB(dest *db.Macro) bool {
|
|
if dest == nil {
|
|
return false
|
|
}
|
|
|
|
dest.Command = m.Command
|
|
dest.Name = m.Name
|
|
dest.Type = m.Type
|
|
dest.Img = m.Img
|
|
dest.ID = m.ID
|
|
dest.Author = m.Author
|
|
dest.Scope = m.Scope
|
|
dest.Folder = m.Folder
|
|
dest.Sort = m.Sort
|
|
|
|
m.Stats.ToDB(&dest.Stats)
|
|
|
|
OwnershipToDB(&dest.Ownership, m.Ownership)
|
|
|
|
return true
|
|
}
|