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,169 @@
package json
import "gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/temp_models/db"
type Token struct {
DisplayName int `json:"displayName"`
DisplayBars int `json:"displayBars"`
Disposition int `json:"disposition"`
Sight TokenSight `json:"sight"`
Name string `json:"name"`
ActorLink bool `json:"actorLink"`
AppendNumber bool `json:"appendNumber"`
PrependAdjective bool `json:"prependAdjective"`
Texture TokenTexture `json:"texture"`
Width float64 `json:"width"`
Height float64 `json:"height"`
LockRotation bool `json:"lockRotation"`
Rotation int `json:"rotation"`
Alpha int `json:"alpha"`
Bar1 TokenBar `json:"bar1"`
Bar2 TokenBar `json:"bar2"`
Light Light `json:"light"`
RandomImg bool `json:"randomImg"`
Occludable TokenOccludable `json:"occludable"`
Ring Ring `json:"ring"`
TurnMarker TokenTurnMarker `json:"turnMarker"`
MovementAction any `json:"movementAction"`
// Flags any `json:"flags"`
// DetectionModes []any `json:"detectionModes"`
}
func (t *Token) ToDB(dest *db.Token) bool {
if dest == nil {
return false
}
dest.DisplayName = t.DisplayName
dest.DisplayBars = t.DisplayBars
dest.Disposition = t.Disposition
dest.Name = t.Name
dest.ActorLink = t.ActorLink
dest.AppendNumber = t.AppendNumber
dest.PrependAdjective = t.PrependAdjective
dest.Width = t.Width
dest.Height = t.Height
dest.LockRotation = t.LockRotation
dest.Rotation = t.Rotation
dest.Alpha = t.Alpha
dest.RandomImg = t.RandomImg
t.Ring.ToDB(&dest.Ring)
t.Sight.ToDB(&dest.Sight)
t.Texture.ToDB(&dest.Texture)
t.Bar1.ToDB(&dest.Bar1)
t.Bar2.ToDB(&dest.Bar2)
t.Light.ToDB(&dest.Light)
t.Occludable.ToDB(&dest.Occludable)
t.TurnMarker.ToDB(&dest.TurnMarker)
return true
}
type TokenTexture struct {
Src string `json:"src"`
ScaleX float64 `json:"scaleX"`
ScaleY float64 `json:"scaleY"`
OffsetX float64 `json:"offsetX"`
OffsetY float64 `json:"offsetY"`
Rotation float64 `json:"rotation"`
AnchorX float64 `json:"anchorX"`
AnchorY float64 `json:"anchorY"`
Fit string `json:"fit"`
Tint string `json:"tint"`
AlphaThreshold float64 `json:"alphaThreshold"`
}
func (t *TokenTexture) ToDB(dest *db.TokenTexture) bool {
if dest == nil {
return false
}
dest.Src = t.Src
dest.ScaleX = t.ScaleX
dest.ScaleY = t.ScaleY
dest.OffsetX = t.OffsetX
dest.OffsetY = t.OffsetY
dest.Rotation = t.Rotation
dest.AnchorX = t.AnchorX
dest.AnchorY = t.AnchorY
dest.Fit = t.Fit
dest.Tint = t.Tint
dest.AlphaThreshold = t.AlphaThreshold
return true
}
type TokenSight struct {
Color string
Enabled bool
Range int
Angle int
VisionMode string
Attenuation float64
Brightness float64
}
func (t *TokenSight) ToDB(dest *db.TokenSight) bool {
if dest == nil {
return false
}
dest.Color = t.Color
dest.Enabled = t.Enabled
dest.Range = t.Range
dest.Angle = t.Angle
dest.VisionMode = t.VisionMode
dest.Attenuation = t.Attenuation
dest.Brightness = t.Brightness
return true
}
type TokenBar struct {
Attribute string `json:"attribute"`
}
func (t *TokenBar) ToDB(dest *db.TokenBar) bool {
if dest == nil {
return false
}
dest.Attribute = t.Attribute
return true
}
type TokenOccludable struct {
Radius int `json:"radius"`
}
func (t *TokenOccludable) ToDB(dest *db.TokenOccludable) bool {
if dest == nil {
return false
}
dest.Radius = t.Radius
return true
}
type TokenTurnMarker struct {
Mode int `json:"mode"`
Animation string `json:"animation"`
Src string `json:"src"`
Disposition bool `json:"disposition"`
}
func (t *TokenTurnMarker) ToDB(dest *db.TokenTurnMarker) bool {
if dest == nil {
return false
}
dest.Mode = t.Mode
dest.Animation = t.Animation
dest.Src = t.Src
dest.Disposition = t.Disposition
return true
}