add new models, change migration files, prepare to add all new tables from models
This commit is contained in:
30
internal/foundry/temp_models/json/journal.go
Normal file
30
internal/foundry/temp_models/json/journal.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package json
|
||||
|
||||
import "gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/temp_models/db"
|
||||
|
||||
type Journal struct {
|
||||
Folder any `json:"folder"`
|
||||
Name string `json:"name"`
|
||||
Pages []*JournalPage `json:"pages"`
|
||||
Sort int `json:"sort"`
|
||||
Ownership map[string]int `json:"ownership,omitempty"`
|
||||
ID string `json:"_id"`
|
||||
// JournalFlags any `json:"flags,omitempty"`
|
||||
// JournalStats Stats `json:"_stats"`
|
||||
// Categories []any `json:"categories"`
|
||||
}
|
||||
|
||||
func (j *Journal) ToDB(dest *db.Journal) bool {
|
||||
if dest == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
dest.Name = j.Name
|
||||
dest.Sort = j.Sort
|
||||
dest.ID = j.ID
|
||||
|
||||
OwnershipToDB(&dest.Ownership, j.Ownership)
|
||||
CopySliceToDB(&dest.Pages, j.Pages)
|
||||
|
||||
return true
|
||||
}
|
||||
Reference in New Issue
Block a user