add new models, change migration files, prepare to add all new tables from models
This commit is contained in:
55
internal/foundry/temp_models/json/ring.go
Normal file
55
internal/foundry/temp_models/json/ring.go
Normal file
@@ -0,0 +1,55 @@
|
||||
package json
|
||||
|
||||
import "gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/temp_models/db"
|
||||
|
||||
type Ring struct {
|
||||
Enabled bool `json:"enabled"`
|
||||
RingColors RingColors `json:"colors"`
|
||||
Effects int `json:"effects"`
|
||||
Subject Subject `json:"subject"`
|
||||
}
|
||||
|
||||
func (r *Ring) ToDB(dest *db.Ring) bool {
|
||||
if dest == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
dest.Enabled = r.Enabled
|
||||
dest.Effects = r.Effects
|
||||
r.RingColors.ToDB(&dest.RingColors)
|
||||
r.Subject.ToDB(&dest.Subject)
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
type RingColors struct {
|
||||
Ring string `json:"ring"`
|
||||
Background string `json:"background"`
|
||||
}
|
||||
|
||||
func (r *RingColors) ToDB(dest *db.RingColors) bool {
|
||||
if dest == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
dest.Ring = r.Ring
|
||||
dest.Background = r.Background
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
type Subject struct {
|
||||
Scale int `json:"scale"`
|
||||
Texture string `json:"texture"`
|
||||
}
|
||||
|
||||
func (s *Subject) ToDB(dest *db.Subject) bool {
|
||||
if dest == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
dest.Scale = s.Scale
|
||||
dest.Texture = s.Texture
|
||||
|
||||
return true
|
||||
}
|
||||
Reference in New Issue
Block a user