add new models, change migration files, prepare to add all new tables from models
This commit is contained in:
58
internal/foundry/temp_models/json/wall.go
Normal file
58
internal/foundry/temp_models/json/wall.go
Normal file
@@ -0,0 +1,58 @@
|
||||
package json
|
||||
|
||||
import "gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/temp_models/db"
|
||||
|
||||
type Wall struct {
|
||||
C []int `json:"c"`
|
||||
Light int `json:"light"`
|
||||
Move int `json:"move"`
|
||||
Sight int `json:"sight"`
|
||||
Sound int `json:"sound"`
|
||||
Dir int `json:"dir"`
|
||||
Door int `json:"door"`
|
||||
Ds int `json:"ds"`
|
||||
ID string `json:"_id"`
|
||||
Threshold Threshold `json:"threshold"`
|
||||
Animation any `json:"animation"`
|
||||
// WallsFlags any `json:"flags"`
|
||||
}
|
||||
|
||||
func (w *Wall) ToDB(dest *db.Wall) bool {
|
||||
if dest == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
dest.Light = w.Light
|
||||
dest.Move = w.Move
|
||||
dest.Sight = w.Sight
|
||||
dest.Sound = w.Sound
|
||||
dest.Dir = w.Dir
|
||||
dest.Door = w.Door
|
||||
dest.Ds = w.Ds
|
||||
dest.ID = w.ID
|
||||
w.Threshold.ToDB(&dest.Threshold)
|
||||
|
||||
copy(dest.C, w.C)
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
type Threshold struct {
|
||||
Light int `json:"light"`
|
||||
Sight int `json:"sight"`
|
||||
Sound int `json:"sound"`
|
||||
Attenuation bool `json:"attenuation"`
|
||||
}
|
||||
|
||||
func (t *Threshold) ToDB(dest *db.Threshold) bool {
|
||||
if dest == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
dest.Light = t.Light
|
||||
dest.Sight = t.Sight
|
||||
dest.Sound = t.Sound
|
||||
dest.Attenuation = t.Attenuation
|
||||
|
||||
return true
|
||||
}
|
||||
Reference in New Issue
Block a user