add new models, change migration files, prepare to add all new tables from models
This commit is contained in:
40
internal/foundry/temp_models/json/macro.go
Normal file
40
internal/foundry/temp_models/json/macro.go
Normal file
@@ -0,0 +1,40 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user