45 lines
1019 B
Go
45 lines
1019 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
|
|
}
|
|
|
|
macro := &db.Macro{
|
|
Command: m.Command,
|
|
Name: m.Name,
|
|
Type: m.Type,
|
|
Img: m.Img,
|
|
ID: m.ID,
|
|
Author: m.Author,
|
|
Scope: m.Scope,
|
|
Folder: m.Folder,
|
|
Sort: m.Sort,
|
|
}
|
|
|
|
m.Stats.ToDB(¯o.Stats)
|
|
|
|
OwnershipToDB(¯o.Ownership, m.Ownership)
|
|
|
|
*dest = macro
|
|
|
|
return true
|
|
}
|