add new models, change migration files, prepare to add all new tables from models

This commit is contained in:
lbenedar
2026-04-15 17:01:30 +03:00
parent 5bb592ea8a
commit 69d3d38ab7
95 changed files with 5371 additions and 12 deletions

View File

@@ -0,0 +1,67 @@
package json
import "gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/temp_models/db"
type Message struct {
Content string `json:"content"`
Style int `json:"style"`
Author string `json:"author"`
Id string `json:"_id"`
Type string `json:"type"`
Timestamp int64 `json:"timestamp"`
Flavor string `json:"flavor"`
Speaker Speaker `json:"speaker"`
Whisper []string `json:"whisper"`
Blind bool `json:"blind"`
Rolls []string `json:"rolls"`
Sound string `json:"sound"`
Emote bool `json:"emote"`
Stats Stats `json:"_stats"`
// System any `json:"system"`
// Flags any `json:"flags"`
}
func (m *Message) ToDB(dest *db.Message) bool {
if dest == nil {
return false
}
dest.Content = m.Content
dest.Style = m.Style
dest.Author = m.Author
dest.ID = m.Id
dest.Type = m.Type
dest.Timestamp = m.Timestamp
dest.Flavor = m.Flavor
dest.Blind = m.Blind
dest.Sound = m.Sound
dest.Emote = m.Emote
m.Speaker.ToDB(&dest.Speaker)
m.Stats.ToDB(&dest.Stats)
copy(dest.Whisper, m.Whisper)
copy(dest.Rolls, m.Rolls)
return true
}
type Speaker struct {
Scene string `json:"scene,omitempty"`
Actor string `json:"actor,omitempty"`
Token string `json:"token,omitempty"`
Alias string `json:"alias,omitempty"`
}
func (s *Speaker) ToDB(dest *db.Speaker) bool {
if dest == nil {
return false
}
dest.Scene = s.Scene
dest.Actor = s.Actor
dest.Token = s.Token
dest.Alias = s.Alias
return true
}