add new models, change migration files, prepare to add all new tables from models
This commit is contained in:
@@ -1,7 +1,11 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/temp_models/db"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (app *application) ShowText(w http.ResponseWriter, r *http.Request) {
|
func (app *application) ShowText(w http.ResponseWriter, r *http.Request) {
|
||||||
@@ -12,7 +16,22 @@ func (app *application) ShowText(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
w.Write(data)
|
var dbGame db.Game
|
||||||
|
|
||||||
|
start := time.Now()
|
||||||
|
data.ToDB(&dbGame)
|
||||||
|
elapsed := time.Since(start)
|
||||||
|
|
||||||
|
app.slogger.Info("Game data successfully parsed", "elapsedtime", elapsed)
|
||||||
|
|
||||||
|
byteData, err := json.Marshal(data)
|
||||||
|
if err != nil {
|
||||||
|
app.slogger.Error("", "error", err)
|
||||||
|
w.Write([]byte(err.Error()))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
w.Write(byteData)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (app *application) WhenNextSession(w http.ResponseWriter, r *http.Request) {
|
func (app *application) WhenNextSession(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ func (app *application) parseFlags() *requests.FoundryHttpRequest {
|
|||||||
return &foundryHttpData
|
return &foundryHttpData
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Handle grace application exit
|
// TODO: Handle DB connection error
|
||||||
func main() {
|
func main() {
|
||||||
app := application{foundryApp: &foundry.FoundryApi{}}
|
app := application{foundryApp: &foundry.FoundryApi{}}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -2,12 +2,14 @@ package foundry
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/actions"
|
"gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/actions"
|
||||||
"gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/requests"
|
"gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/requests"
|
||||||
|
json_models "gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/temp_models/json"
|
||||||
"gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/transport"
|
"gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/transport"
|
||||||
"gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/types"
|
"gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/types"
|
||||||
)
|
)
|
||||||
@@ -218,7 +220,7 @@ func (foundry *FoundryApi) StartListenFoundry() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (foundry *FoundryApi) Test() ([]byte, error) {
|
func (foundry *FoundryApi) Test() (*json_models.Game, error) {
|
||||||
wsMsg := types.NewWsMessage("world", foundry.transport.CurrWsId)
|
wsMsg := types.NewWsMessage("world", foundry.transport.CurrWsId)
|
||||||
foundry.transport.CurrWsId++
|
foundry.transport.CurrWsId++
|
||||||
|
|
||||||
@@ -226,8 +228,18 @@ func (foundry *FoundryApi) Test() ([]byte, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
// foundry.transport.Logger.Info("World data", "answer", string(answer))
|
|
||||||
return answer, nil
|
var game []json_models.Game
|
||||||
|
|
||||||
|
start := time.Now()
|
||||||
|
err = json.Unmarshal(answer, &game)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
elapsed := time.Since(start)
|
||||||
|
|
||||||
|
foundry.transport.Logger.Info("World data successfully received and parsed", "parseTime", elapsed)
|
||||||
|
return &game[0], nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: remove
|
// TODO: remove
|
||||||
|
|||||||
15
internal/foundry/temp_models/db/actor.go
Normal file
15
internal/foundry/temp_models/db/actor.go
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
package db
|
||||||
|
|
||||||
|
type Actor struct {
|
||||||
|
ID string
|
||||||
|
|
||||||
|
Img string
|
||||||
|
Name string
|
||||||
|
Type string
|
||||||
|
Folder string
|
||||||
|
Sort int
|
||||||
|
PrototypeToken Token
|
||||||
|
Stats Stats
|
||||||
|
Items []Item
|
||||||
|
Ownership []OwnershipString
|
||||||
|
}
|
||||||
9
internal/foundry/temp_models/db/addresses.go
Normal file
9
internal/foundry/temp_models/db/addresses.go
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
package db
|
||||||
|
|
||||||
|
type Addresses struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
Local string
|
||||||
|
Remote string
|
||||||
|
RemoteIsAccessible bool
|
||||||
|
}
|
||||||
11
internal/foundry/temp_models/db/authors.go
Normal file
11
internal/foundry/temp_models/db/authors.go
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
package db
|
||||||
|
|
||||||
|
type Author struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
Name string
|
||||||
|
URL string
|
||||||
|
Email string
|
||||||
|
Discord string
|
||||||
|
// SystemAuthorsFlags SystemAuthorsFlags `json:"flags"`
|
||||||
|
}
|
||||||
54
internal/foundry/temp_models/db/card.go
Normal file
54
internal/foundry/temp_models/db/card.go
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
package db
|
||||||
|
|
||||||
|
type CardDeck struct {
|
||||||
|
ID string
|
||||||
|
|
||||||
|
Name string
|
||||||
|
Type string
|
||||||
|
Description string
|
||||||
|
Img string
|
||||||
|
Folder string
|
||||||
|
Width int
|
||||||
|
Height int
|
||||||
|
Rotation int
|
||||||
|
Sort int
|
||||||
|
DisplayCount bool
|
||||||
|
Stats Stats
|
||||||
|
Ownership Ownership
|
||||||
|
Cards []Card
|
||||||
|
}
|
||||||
|
|
||||||
|
type Card struct {
|
||||||
|
ID string
|
||||||
|
|
||||||
|
Name string
|
||||||
|
Type string
|
||||||
|
Suit string
|
||||||
|
Description string
|
||||||
|
Origin string
|
||||||
|
Width int
|
||||||
|
Height int
|
||||||
|
Rotation int
|
||||||
|
Value int
|
||||||
|
Face int
|
||||||
|
Sort int
|
||||||
|
Drawn bool
|
||||||
|
Back Back
|
||||||
|
Stats Stats
|
||||||
|
Faces []Face
|
||||||
|
}
|
||||||
|
|
||||||
|
type Face struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
Name string
|
||||||
|
Img string
|
||||||
|
Text string
|
||||||
|
}
|
||||||
|
|
||||||
|
type Back struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
Name string
|
||||||
|
Text string
|
||||||
|
}
|
||||||
34
internal/foundry/temp_models/db/combat.go
Normal file
34
internal/foundry/temp_models/db/combat.go
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
package db
|
||||||
|
|
||||||
|
type Combat struct {
|
||||||
|
ID string
|
||||||
|
|
||||||
|
Type string
|
||||||
|
Scene string
|
||||||
|
Round int
|
||||||
|
Turn int
|
||||||
|
Sort int
|
||||||
|
Active bool
|
||||||
|
Stats Stats
|
||||||
|
Groups []string
|
||||||
|
Combatants []Combatant
|
||||||
|
// System any `json:"system"`
|
||||||
|
// Flags any `json:"flags"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Combatant struct {
|
||||||
|
ID string
|
||||||
|
|
||||||
|
TokenId string
|
||||||
|
SceneId string
|
||||||
|
ActorId string
|
||||||
|
Type string
|
||||||
|
Img string
|
||||||
|
Group string
|
||||||
|
Initiative int
|
||||||
|
Hidden bool
|
||||||
|
Defeated bool
|
||||||
|
Stats Stats
|
||||||
|
// System any `json:"system"`
|
||||||
|
// Flags any `json:"flags"`
|
||||||
|
}
|
||||||
9
internal/foundry/temp_models/db/compatibility.go
Normal file
9
internal/foundry/temp_models/db/compatibility.go
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
package db
|
||||||
|
|
||||||
|
type Compatibility struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
Minimum string
|
||||||
|
Verified string
|
||||||
|
Maximum string
|
||||||
|
}
|
||||||
7
internal/foundry/temp_models/db/details_language.go
Normal file
7
internal/foundry/temp_models/db/details_language.go
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
package db
|
||||||
|
|
||||||
|
type DetailsLanguages struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
Details string
|
||||||
|
}
|
||||||
14
internal/foundry/temp_models/db/document_types.go
Normal file
14
internal/foundry/temp_models/db/document_types.go
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
package db
|
||||||
|
|
||||||
|
type DocumentTypes struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
Data []DocumentTypeData
|
||||||
|
}
|
||||||
|
|
||||||
|
type DocumentTypeData struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
Type string
|
||||||
|
HtmlFields []string
|
||||||
|
}
|
||||||
44
internal/foundry/temp_models/db/environment.go
Normal file
44
internal/foundry/temp_models/db/environment.go
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
package db
|
||||||
|
|
||||||
|
type Environment struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
GlobalLight EnvironmentGlobalLight
|
||||||
|
DarknessLevel float64
|
||||||
|
DarknessLock bool
|
||||||
|
Cycle bool
|
||||||
|
ScenesEnvironmentBase EnvironmentBase
|
||||||
|
Dark EnvironmentBase
|
||||||
|
}
|
||||||
|
|
||||||
|
type EnvironmentGlobalLight struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
Enabled bool
|
||||||
|
Darkness GlobalLightDarkness
|
||||||
|
Alpha float64
|
||||||
|
Bright bool
|
||||||
|
Color string
|
||||||
|
Coloration float64
|
||||||
|
Luminosity float64
|
||||||
|
Saturation float64
|
||||||
|
Contrast float64
|
||||||
|
Shadows float64
|
||||||
|
}
|
||||||
|
|
||||||
|
type EnvironmentBase struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
Hue float64
|
||||||
|
Intensity float64
|
||||||
|
Luminosity float64
|
||||||
|
Saturation float64
|
||||||
|
Shadows float64
|
||||||
|
}
|
||||||
|
|
||||||
|
type GlobalLightDarkness struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
Max int
|
||||||
|
Min int
|
||||||
|
}
|
||||||
7
internal/foundry/temp_models/db/files.go
Normal file
7
internal/foundry/temp_models/db/files.go
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
package db
|
||||||
|
|
||||||
|
type Files struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
Storages []string
|
||||||
|
}
|
||||||
25
internal/foundry/temp_models/db/folder.go
Normal file
25
internal/foundry/temp_models/db/folder.go
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
package db
|
||||||
|
|
||||||
|
type Folder struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
Name string
|
||||||
|
Sorting string
|
||||||
|
Color string
|
||||||
|
Packs []string
|
||||||
|
Folders []Folder
|
||||||
|
}
|
||||||
|
|
||||||
|
type WorldFolder struct {
|
||||||
|
ID string
|
||||||
|
|
||||||
|
Name string
|
||||||
|
Type string
|
||||||
|
Folder string
|
||||||
|
Sorting string
|
||||||
|
Description string
|
||||||
|
Color string
|
||||||
|
Sort int
|
||||||
|
Stats Stats
|
||||||
|
// Flags any `json:"flags,omitempty"`
|
||||||
|
}
|
||||||
19
internal/foundry/temp_models/db/foundry_data.go
Normal file
19
internal/foundry/temp_models/db/foundry_data.go
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
package db
|
||||||
|
|
||||||
|
import "time"
|
||||||
|
|
||||||
|
type FoundryDataType string
|
||||||
|
|
||||||
|
const (
|
||||||
|
SetupType = FoundryDataType("setup")
|
||||||
|
GameType = FoundryDataType("game")
|
||||||
|
)
|
||||||
|
|
||||||
|
type FoundryData struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
Type FoundryDataType
|
||||||
|
Setup *Setup
|
||||||
|
Game *Game
|
||||||
|
CreatedAt time.Time
|
||||||
|
}
|
||||||
35
internal/foundry/temp_models/db/game.go
Normal file
35
internal/foundry/temp_models/db/game.go
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
package db
|
||||||
|
|
||||||
|
type Game struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
DemoMode bool
|
||||||
|
IdleLogout bool
|
||||||
|
Paused bool
|
||||||
|
UserID string
|
||||||
|
Addresses Addresses
|
||||||
|
Files Files
|
||||||
|
Options GameOptions
|
||||||
|
Release Release
|
||||||
|
World World
|
||||||
|
System System
|
||||||
|
CoreUpdate CoreUpdate
|
||||||
|
SystemUpdate SystemUpdate
|
||||||
|
ActiveUsers []string
|
||||||
|
Modules []Module
|
||||||
|
PackageWarnings []PackageWarning
|
||||||
|
Packs []Pack
|
||||||
|
Messages []Message
|
||||||
|
Combats []Combat
|
||||||
|
CardDeck []CardDeck
|
||||||
|
Users []User
|
||||||
|
Macros []Macro
|
||||||
|
Folders []WorldFolder
|
||||||
|
Items []Item
|
||||||
|
Settings []Setting
|
||||||
|
Journals []Journal
|
||||||
|
Tables []Table
|
||||||
|
Playlists []Playlist
|
||||||
|
Actors []Actor //
|
||||||
|
// Scenes []Scene
|
||||||
|
}
|
||||||
15
internal/foundry/temp_models/db/grid.go
Normal file
15
internal/foundry/temp_models/db/grid.go
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
package db
|
||||||
|
|
||||||
|
type Grid struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
Type int
|
||||||
|
Size int
|
||||||
|
Distance int
|
||||||
|
Diagonals int
|
||||||
|
Thickness int
|
||||||
|
Alpha float64
|
||||||
|
Color string
|
||||||
|
Units string
|
||||||
|
Style string
|
||||||
|
}
|
||||||
10
internal/foundry/temp_models/db/index.go
Normal file
10
internal/foundry/temp_models/db/index.go
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
package db
|
||||||
|
|
||||||
|
type Index struct {
|
||||||
|
ID string
|
||||||
|
|
||||||
|
Folder string
|
||||||
|
Img string
|
||||||
|
Name string
|
||||||
|
Type string
|
||||||
|
}
|
||||||
13
internal/foundry/temp_models/db/item.go
Normal file
13
internal/foundry/temp_models/db/item.go
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
package db
|
||||||
|
|
||||||
|
type Item struct {
|
||||||
|
ID string
|
||||||
|
|
||||||
|
Img string
|
||||||
|
Name string
|
||||||
|
Type string
|
||||||
|
Folder string
|
||||||
|
Sort int
|
||||||
|
Stats Stats
|
||||||
|
Ownership []OwnershipString
|
||||||
|
}
|
||||||
10
internal/foundry/temp_models/db/journal.go
Normal file
10
internal/foundry/temp_models/db/journal.go
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
package db
|
||||||
|
|
||||||
|
type Journal struct {
|
||||||
|
ID string
|
||||||
|
|
||||||
|
Name string
|
||||||
|
Sort int
|
||||||
|
Pages []JournalPage
|
||||||
|
Ownership []OwnershipString
|
||||||
|
}
|
||||||
37
internal/foundry/temp_models/db/journal_page.go
Normal file
37
internal/foundry/temp_models/db/journal_page.go
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
package db
|
||||||
|
|
||||||
|
type JournalPage struct {
|
||||||
|
ID string
|
||||||
|
|
||||||
|
Name string
|
||||||
|
Type string
|
||||||
|
Src string
|
||||||
|
Sort int
|
||||||
|
Text PageText
|
||||||
|
Title PageTitle
|
||||||
|
Video PageVideo
|
||||||
|
Stats Stats
|
||||||
|
Ownership []OwnershipString
|
||||||
|
}
|
||||||
|
|
||||||
|
type PageText struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
Content string
|
||||||
|
Markdown string
|
||||||
|
Format int
|
||||||
|
}
|
||||||
|
|
||||||
|
type PageTitle struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
Show bool
|
||||||
|
Level int
|
||||||
|
}
|
||||||
|
|
||||||
|
type PageVideo struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
Controls bool
|
||||||
|
Volume float64
|
||||||
|
}
|
||||||
23
internal/foundry/temp_models/db/language.go
Normal file
23
internal/foundry/temp_models/db/language.go
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
package db
|
||||||
|
|
||||||
|
type Language struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
Lang string
|
||||||
|
Name string
|
||||||
|
Path string
|
||||||
|
}
|
||||||
|
|
||||||
|
type SetupLanguage struct {
|
||||||
|
ID string
|
||||||
|
|
||||||
|
Label string
|
||||||
|
Modules []SetupLanguageModule
|
||||||
|
}
|
||||||
|
|
||||||
|
type SetupLanguageModule struct {
|
||||||
|
ID string
|
||||||
|
|
||||||
|
Label string
|
||||||
|
Path string
|
||||||
|
}
|
||||||
35
internal/foundry/temp_models/db/light.go
Normal file
35
internal/foundry/temp_models/db/light.go
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
package db
|
||||||
|
|
||||||
|
type Light struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
Color string
|
||||||
|
Priority int
|
||||||
|
Angle int
|
||||||
|
Negative bool
|
||||||
|
Alpha float64
|
||||||
|
Bright float64
|
||||||
|
Coloration float64
|
||||||
|
Dim float64
|
||||||
|
Attenuation float64
|
||||||
|
Luminosity float64
|
||||||
|
Saturation float64
|
||||||
|
Contrast float64
|
||||||
|
Shadows float64
|
||||||
|
LightAnimation LightAnimation
|
||||||
|
LightDarkness LightDarkness
|
||||||
|
}
|
||||||
|
|
||||||
|
type LightAnimation struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
Speed int
|
||||||
|
Intensity int
|
||||||
|
Reverse bool
|
||||||
|
}
|
||||||
|
type LightDarkness struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
Min float64
|
||||||
|
Max float64
|
||||||
|
}
|
||||||
16
internal/foundry/temp_models/db/macro.go
Normal file
16
internal/foundry/temp_models/db/macro.go
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
package db
|
||||||
|
|
||||||
|
type Macro struct {
|
||||||
|
ID string
|
||||||
|
|
||||||
|
Command string
|
||||||
|
Name string
|
||||||
|
Type string
|
||||||
|
Img string
|
||||||
|
Author string
|
||||||
|
Scope string
|
||||||
|
Folder string
|
||||||
|
Sort int
|
||||||
|
Stats Stats
|
||||||
|
Ownership []OwnershipString
|
||||||
|
}
|
||||||
9
internal/foundry/temp_models/db/media.go
Normal file
9
internal/foundry/temp_models/db/media.go
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
package db
|
||||||
|
|
||||||
|
type Media struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
Type string
|
||||||
|
URL string
|
||||||
|
Caption string
|
||||||
|
}
|
||||||
28
internal/foundry/temp_models/db/message.go
Normal file
28
internal/foundry/temp_models/db/message.go
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
package db
|
||||||
|
|
||||||
|
type Message struct {
|
||||||
|
ID string
|
||||||
|
|
||||||
|
Blind bool
|
||||||
|
Emote bool
|
||||||
|
Style int
|
||||||
|
Timestamp int64
|
||||||
|
Content string
|
||||||
|
Author string
|
||||||
|
Type string
|
||||||
|
Flavor string
|
||||||
|
Sound string
|
||||||
|
Stats Stats
|
||||||
|
Speaker Speaker
|
||||||
|
Whisper []string
|
||||||
|
Rolls []string
|
||||||
|
}
|
||||||
|
|
||||||
|
type Speaker struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
Scene string
|
||||||
|
Actor string
|
||||||
|
Token string
|
||||||
|
Alias string
|
||||||
|
}
|
||||||
40
internal/foundry/temp_models/db/module.go
Normal file
40
internal/foundry/temp_models/db/module.go
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
package db
|
||||||
|
|
||||||
|
type Module struct {
|
||||||
|
ID string
|
||||||
|
|
||||||
|
Title string
|
||||||
|
Description string
|
||||||
|
URL string
|
||||||
|
License string
|
||||||
|
Readme string
|
||||||
|
Bugs string
|
||||||
|
Changelog string
|
||||||
|
Version string
|
||||||
|
Socket bool
|
||||||
|
Manifest string
|
||||||
|
Download string
|
||||||
|
Protected bool
|
||||||
|
Exclusive bool
|
||||||
|
PersistentStorage bool
|
||||||
|
CoreTranslation bool
|
||||||
|
Library bool
|
||||||
|
Availability int
|
||||||
|
Locked bool
|
||||||
|
Owned bool
|
||||||
|
HasStorage bool
|
||||||
|
Active bool
|
||||||
|
DocumentTypes DocumentTypes
|
||||||
|
Relationships Relationships
|
||||||
|
Compatibility Compatibility
|
||||||
|
Authors []Author
|
||||||
|
Media []Media
|
||||||
|
Scripts []string
|
||||||
|
Esmodules []string
|
||||||
|
Styles []Style
|
||||||
|
Languages []Language
|
||||||
|
Packs []Pack
|
||||||
|
PackFolders []Folder
|
||||||
|
Tags []string
|
||||||
|
// ModulesFlags ModulesFlags `json:"flags,omitempty"`
|
||||||
|
}
|
||||||
36
internal/foundry/temp_models/db/notes.go
Normal file
36
internal/foundry/temp_models/db/notes.go
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
package db
|
||||||
|
|
||||||
|
type Note struct {
|
||||||
|
ID string
|
||||||
|
|
||||||
|
EntryID string
|
||||||
|
PageID string
|
||||||
|
Text string
|
||||||
|
X float64
|
||||||
|
Y float64
|
||||||
|
Global bool
|
||||||
|
IconSize int
|
||||||
|
Texture NoteTexture
|
||||||
|
FontFamily string
|
||||||
|
FontSize int
|
||||||
|
TextColor string
|
||||||
|
TextAnchor int
|
||||||
|
Elevation int
|
||||||
|
Sort int
|
||||||
|
}
|
||||||
|
|
||||||
|
type NoteTexture struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
Tint string
|
||||||
|
Src string
|
||||||
|
ScaleX int
|
||||||
|
ScaleY int
|
||||||
|
OffsetX float64
|
||||||
|
OffsetY float64
|
||||||
|
Rotation int
|
||||||
|
AnchorX float64
|
||||||
|
AnchorY float64
|
||||||
|
Fit string
|
||||||
|
AlphaThreshold int
|
||||||
|
}
|
||||||
30
internal/foundry/temp_models/db/options.go
Normal file
30
internal/foundry/temp_models/db/options.go
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
package db
|
||||||
|
|
||||||
|
type GameOptions struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
Language string
|
||||||
|
UpdateChannel string
|
||||||
|
Port int
|
||||||
|
}
|
||||||
|
|
||||||
|
type SetupOptions struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
CompressSocket bool
|
||||||
|
CompressStatic bool
|
||||||
|
CSSTheme string
|
||||||
|
DataPath string
|
||||||
|
Fullscreen bool
|
||||||
|
Hostname string
|
||||||
|
HotReload bool
|
||||||
|
Language string
|
||||||
|
LocalHostname string
|
||||||
|
Port int
|
||||||
|
ProxySSL bool
|
||||||
|
Telemetry bool
|
||||||
|
UpdateChannel string
|
||||||
|
Upnp bool
|
||||||
|
DeleteNEDB bool
|
||||||
|
NoBackups bool
|
||||||
|
}
|
||||||
16
internal/foundry/temp_models/db/ownership.go
Normal file
16
internal/foundry/temp_models/db/ownership.go
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
package db
|
||||||
|
|
||||||
|
type Ownership struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
Player string
|
||||||
|
Trusted string
|
||||||
|
Assistant string
|
||||||
|
}
|
||||||
|
|
||||||
|
type OwnershipString struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
Key string
|
||||||
|
Value int
|
||||||
|
}
|
||||||
27
internal/foundry/temp_models/db/pack.go
Normal file
27
internal/foundry/temp_models/db/pack.go
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
package db
|
||||||
|
|
||||||
|
type Pack struct {
|
||||||
|
ID string
|
||||||
|
|
||||||
|
Name string
|
||||||
|
Label string
|
||||||
|
Banner string
|
||||||
|
Path string
|
||||||
|
Type string
|
||||||
|
System string
|
||||||
|
PackageType string
|
||||||
|
PackageName string
|
||||||
|
Ownership Ownership
|
||||||
|
Index []Index
|
||||||
|
Folders []PackFolder
|
||||||
|
}
|
||||||
|
|
||||||
|
type PackFolder struct {
|
||||||
|
ID string
|
||||||
|
|
||||||
|
Description string
|
||||||
|
Name string
|
||||||
|
Sort int
|
||||||
|
Sorting string
|
||||||
|
Type string
|
||||||
|
}
|
||||||
18
internal/foundry/temp_models/db/package_warnings.go
Normal file
18
internal/foundry/temp_models/db/package_warnings.go
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
package db
|
||||||
|
|
||||||
|
type PackageWarningsData struct {
|
||||||
|
ID string
|
||||||
|
|
||||||
|
Type string
|
||||||
|
Warning []string
|
||||||
|
Error []string
|
||||||
|
Reinstallable bool
|
||||||
|
Manifest string
|
||||||
|
}
|
||||||
|
|
||||||
|
type PackageWarning struct {
|
||||||
|
ID string
|
||||||
|
|
||||||
|
Key string
|
||||||
|
Value PackageWarningsData
|
||||||
|
}
|
||||||
34
internal/foundry/temp_models/db/playlist.go
Normal file
34
internal/foundry/temp_models/db/playlist.go
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
package db
|
||||||
|
|
||||||
|
type Playlist struct {
|
||||||
|
ID string
|
||||||
|
|
||||||
|
Name string
|
||||||
|
Folder string
|
||||||
|
Sorting string
|
||||||
|
Description string
|
||||||
|
Channel string
|
||||||
|
Mode int
|
||||||
|
Fade int
|
||||||
|
Seed int
|
||||||
|
Sort int
|
||||||
|
Playing bool
|
||||||
|
Stats Stats
|
||||||
|
Ownership []OwnershipString
|
||||||
|
Sounds []Sound
|
||||||
|
}
|
||||||
|
|
||||||
|
type Sound struct {
|
||||||
|
ID string
|
||||||
|
|
||||||
|
Name string
|
||||||
|
Path string
|
||||||
|
Channel string
|
||||||
|
Description string
|
||||||
|
Fade int
|
||||||
|
Sort int
|
||||||
|
Repeat bool
|
||||||
|
Playing bool
|
||||||
|
Volume float64
|
||||||
|
PausedTime float64
|
||||||
|
}
|
||||||
16
internal/foundry/temp_models/db/relationships.go
Normal file
16
internal/foundry/temp_models/db/relationships.go
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
package db
|
||||||
|
|
||||||
|
type Relationships struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
Data []RelationshipsData
|
||||||
|
}
|
||||||
|
|
||||||
|
type RelationshipsData struct {
|
||||||
|
ID string
|
||||||
|
|
||||||
|
RelationshipsType string
|
||||||
|
Type string
|
||||||
|
Manifest string
|
||||||
|
Compatibility Compatibility
|
||||||
|
}
|
||||||
14
internal/foundry/temp_models/db/release.go
Normal file
14
internal/foundry/temp_models/db/release.go
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
package db
|
||||||
|
|
||||||
|
type Release struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
Generation int
|
||||||
|
Channel string
|
||||||
|
Suffix string
|
||||||
|
Build int
|
||||||
|
NodeVersion int
|
||||||
|
MaxGeneration int
|
||||||
|
MaxStableGeneration int
|
||||||
|
Time int64
|
||||||
|
}
|
||||||
24
internal/foundry/temp_models/db/ring.go
Normal file
24
internal/foundry/temp_models/db/ring.go
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
package db
|
||||||
|
|
||||||
|
type Ring struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
Enabled bool
|
||||||
|
Effects int
|
||||||
|
RingColors RingColors
|
||||||
|
Subject Subject
|
||||||
|
}
|
||||||
|
|
||||||
|
type RingColors struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
Ring string
|
||||||
|
Background string
|
||||||
|
}
|
||||||
|
|
||||||
|
type Subject struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
Scale int
|
||||||
|
Texture string
|
||||||
|
}
|
||||||
178
internal/foundry/temp_models/db/scene.go
Normal file
178
internal/foundry/temp_models/db/scene.go
Normal file
@@ -0,0 +1,178 @@
|
|||||||
|
package db
|
||||||
|
|
||||||
|
type Scene struct {
|
||||||
|
ID string
|
||||||
|
|
||||||
|
Folder string
|
||||||
|
Name string
|
||||||
|
Active bool
|
||||||
|
Navigation bool
|
||||||
|
NavOrder int
|
||||||
|
NavName string
|
||||||
|
Background SceneBackground
|
||||||
|
Foreground string
|
||||||
|
ForegroundElevation int
|
||||||
|
Thumb string
|
||||||
|
Width int
|
||||||
|
Height int
|
||||||
|
Padding float64
|
||||||
|
Initial SceneInitial
|
||||||
|
BackgroundColor string
|
||||||
|
Grid SceneGrid
|
||||||
|
TokenVision bool
|
||||||
|
Drawings []SceneDrawing
|
||||||
|
Tokens []Token
|
||||||
|
Lights []SceneLight
|
||||||
|
Notes []Note
|
||||||
|
Sounds []ScenesSound
|
||||||
|
Walls []Wall
|
||||||
|
Playlist string
|
||||||
|
PlaylistSound string
|
||||||
|
Journal string
|
||||||
|
JournalEntryPage string
|
||||||
|
Weather string
|
||||||
|
Sort int
|
||||||
|
Ownership []OwnershipString
|
||||||
|
Stats Stats
|
||||||
|
Fog SceneFog
|
||||||
|
Environment Environment
|
||||||
|
}
|
||||||
|
|
||||||
|
type SceneBackground struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
Src string
|
||||||
|
ScaleX float64
|
||||||
|
ScaleY float64
|
||||||
|
OffsetX float64
|
||||||
|
OffsetY float64
|
||||||
|
Rotation int
|
||||||
|
Tint string
|
||||||
|
AnchorX float64
|
||||||
|
AnchorY float64
|
||||||
|
Fit string
|
||||||
|
AlphaThreshold int
|
||||||
|
}
|
||||||
|
|
||||||
|
type SceneInitial struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
X float64
|
||||||
|
Y float64
|
||||||
|
Scale float64
|
||||||
|
}
|
||||||
|
|
||||||
|
type SceneGrid struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
Type int
|
||||||
|
Size int
|
||||||
|
Color string
|
||||||
|
Alpha float64
|
||||||
|
Distance int
|
||||||
|
Units string
|
||||||
|
Style string
|
||||||
|
Thickness int
|
||||||
|
}
|
||||||
|
|
||||||
|
type SceneDrawing struct {
|
||||||
|
ID string
|
||||||
|
|
||||||
|
Author string
|
||||||
|
Shape SceneDrawingShape
|
||||||
|
X float64
|
||||||
|
Y float64
|
||||||
|
Rotation int
|
||||||
|
BezierFactor int
|
||||||
|
FillType int
|
||||||
|
FillColor string
|
||||||
|
FillAlpha float64
|
||||||
|
StrokeWidth int
|
||||||
|
StrokeColor string
|
||||||
|
StrokeAlpha int
|
||||||
|
Texture string
|
||||||
|
Text string
|
||||||
|
FontFamily string
|
||||||
|
FontSize int
|
||||||
|
TextColor string
|
||||||
|
TextAlpha int
|
||||||
|
Hidden bool
|
||||||
|
Locked bool
|
||||||
|
Interface bool
|
||||||
|
Elevation int
|
||||||
|
Sort int
|
||||||
|
}
|
||||||
|
|
||||||
|
type SceneDrawingShape struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
Type string `json:"type"`
|
||||||
|
Width int `json:"width"`
|
||||||
|
Height int `json:"height"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type SceneLight struct {
|
||||||
|
ID string
|
||||||
|
|
||||||
|
X float64
|
||||||
|
Y float64
|
||||||
|
Rotation int
|
||||||
|
Walls bool
|
||||||
|
Vision bool
|
||||||
|
Config Light
|
||||||
|
Hidden bool
|
||||||
|
Elevation int
|
||||||
|
}
|
||||||
|
|
||||||
|
type ScenesSound struct {
|
||||||
|
ID string
|
||||||
|
|
||||||
|
Path string
|
||||||
|
X float64
|
||||||
|
Y float64
|
||||||
|
Radius float64
|
||||||
|
Easing bool
|
||||||
|
Walls bool
|
||||||
|
Volume float64
|
||||||
|
Darkness ScenesSoundsDarkness
|
||||||
|
Repeat bool
|
||||||
|
Hidden bool
|
||||||
|
Elevation float64
|
||||||
|
Effects ScenesSoundsEffects
|
||||||
|
}
|
||||||
|
|
||||||
|
type ScenesSoundsDarkness struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
Min int
|
||||||
|
Max int
|
||||||
|
}
|
||||||
|
|
||||||
|
type ScenesSoundsEffects struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
Base ScenesSoundsEffectsBase
|
||||||
|
Muffled ScenesSoundsEffectsBase
|
||||||
|
}
|
||||||
|
|
||||||
|
type ScenesSoundsEffectsBase struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
Intensity int
|
||||||
|
}
|
||||||
|
|
||||||
|
type SceneFog struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
Exploration bool
|
||||||
|
Reset int64
|
||||||
|
Overlay string
|
||||||
|
Colors SceneFogColors
|
||||||
|
}
|
||||||
|
|
||||||
|
type SceneFogColors struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
Explored string
|
||||||
|
Unexplored string
|
||||||
|
}
|
||||||
9
internal/foundry/temp_models/db/settings.go
Normal file
9
internal/foundry/temp_models/db/settings.go
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
package db
|
||||||
|
|
||||||
|
type Setting struct {
|
||||||
|
ID string
|
||||||
|
|
||||||
|
Key string
|
||||||
|
Value string
|
||||||
|
Stats Stats
|
||||||
|
}
|
||||||
37
internal/foundry/temp_models/db/setup.go
Normal file
37
internal/foundry/temp_models/db/setup.go
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
package db
|
||||||
|
|
||||||
|
type Setup struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
IsAdmin bool
|
||||||
|
IsSetup bool
|
||||||
|
CoreUpdate CoreUpdate
|
||||||
|
FeaturedContent FeaturedContent
|
||||||
|
Files Files
|
||||||
|
Options SetupOptions
|
||||||
|
Release Release
|
||||||
|
Languages []SetupLanguage
|
||||||
|
Modules []Module
|
||||||
|
News []News
|
||||||
|
PackageWarnings []PackageWarning
|
||||||
|
Systems []System
|
||||||
|
Worlds []World
|
||||||
|
}
|
||||||
|
|
||||||
|
type FeaturedContent struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
Title string
|
||||||
|
Caption string
|
||||||
|
URL string
|
||||||
|
Image string
|
||||||
|
}
|
||||||
|
|
||||||
|
type News struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
Title string
|
||||||
|
Caption string
|
||||||
|
URL string
|
||||||
|
Image string
|
||||||
|
}
|
||||||
11
internal/foundry/temp_models/db/stats.go
Normal file
11
internal/foundry/temp_models/db/stats.go
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
package db
|
||||||
|
|
||||||
|
type Stats struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
CoreVersion string
|
||||||
|
SystemID string
|
||||||
|
SystemVersion string
|
||||||
|
LastModifiedBy string
|
||||||
|
ModifiedTime int64
|
||||||
|
}
|
||||||
7
internal/foundry/temp_models/db/style.go
Normal file
7
internal/foundry/temp_models/db/style.go
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
package db
|
||||||
|
|
||||||
|
type Style struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
Src string
|
||||||
|
}
|
||||||
38
internal/foundry/temp_models/db/system.go
Normal file
38
internal/foundry/temp_models/db/system.go
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
package db
|
||||||
|
|
||||||
|
type System struct {
|
||||||
|
ID string
|
||||||
|
|
||||||
|
Title string
|
||||||
|
Description string
|
||||||
|
URL string
|
||||||
|
License string
|
||||||
|
Bugs string
|
||||||
|
Changelog string
|
||||||
|
Version string
|
||||||
|
Socket bool
|
||||||
|
Manifest string
|
||||||
|
Download string
|
||||||
|
Protected bool
|
||||||
|
Exclusive bool
|
||||||
|
PersistentStorage bool
|
||||||
|
Background string
|
||||||
|
PrimaryTokenAttribute string
|
||||||
|
Availability int
|
||||||
|
Locked bool
|
||||||
|
Owned bool
|
||||||
|
HasStorage bool
|
||||||
|
Esmodules []string
|
||||||
|
Scripts []string
|
||||||
|
Tags []string
|
||||||
|
Compatibility Compatibility
|
||||||
|
Relationships Relationships
|
||||||
|
DocumentTypes DocumentTypes
|
||||||
|
Grid Grid
|
||||||
|
Authors []Author
|
||||||
|
Media []Media
|
||||||
|
Packs []Pack
|
||||||
|
Styles []Style
|
||||||
|
Languages []Language
|
||||||
|
PackFolders []Folder
|
||||||
|
}
|
||||||
30
internal/foundry/temp_models/db/table.go
Normal file
30
internal/foundry/temp_models/db/table.go
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
package db
|
||||||
|
|
||||||
|
type Table struct {
|
||||||
|
ID string
|
||||||
|
|
||||||
|
Name string
|
||||||
|
Description string
|
||||||
|
Formula string
|
||||||
|
Img string
|
||||||
|
Folder string
|
||||||
|
Sort int
|
||||||
|
Replacement bool
|
||||||
|
DisplayRoll bool
|
||||||
|
Stats Stats
|
||||||
|
Ownership []OwnershipString
|
||||||
|
Results []TableResult
|
||||||
|
}
|
||||||
|
|
||||||
|
type TableResult struct {
|
||||||
|
ID string
|
||||||
|
|
||||||
|
Type string
|
||||||
|
Img string
|
||||||
|
Description string
|
||||||
|
Name string
|
||||||
|
Weight int
|
||||||
|
Drawn bool
|
||||||
|
Stats Stats
|
||||||
|
Range []int
|
||||||
|
}
|
||||||
76
internal/foundry/temp_models/db/token.go
Normal file
76
internal/foundry/temp_models/db/token.go
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
package db
|
||||||
|
|
||||||
|
type Token struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
Name string
|
||||||
|
ActorLink bool
|
||||||
|
AppendNumber bool
|
||||||
|
PrependAdjective bool
|
||||||
|
LockRotation bool
|
||||||
|
RandomImg bool
|
||||||
|
DisplayName int
|
||||||
|
DisplayBars int
|
||||||
|
Disposition int
|
||||||
|
Rotation int
|
||||||
|
Alpha int
|
||||||
|
Width float64
|
||||||
|
Height float64
|
||||||
|
Ring Ring
|
||||||
|
Sight TokenSight
|
||||||
|
Texture TokenTexture
|
||||||
|
Bar1 TokenBar
|
||||||
|
Bar2 TokenBar
|
||||||
|
Light Light
|
||||||
|
Occludable TokenOccludable
|
||||||
|
TurnMarker TokenTurnMarker
|
||||||
|
}
|
||||||
|
|
||||||
|
type TokenTexture struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
Src string
|
||||||
|
Fit string
|
||||||
|
Tint string
|
||||||
|
ScaleX float64
|
||||||
|
ScaleY float64
|
||||||
|
OffsetX float64
|
||||||
|
OffsetY float64
|
||||||
|
Rotation float64
|
||||||
|
AnchorX float64
|
||||||
|
AnchorY float64
|
||||||
|
AlphaThreshold float64
|
||||||
|
}
|
||||||
|
|
||||||
|
type TokenSight struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
Color string
|
||||||
|
VisionMode string
|
||||||
|
Range int
|
||||||
|
Angle int
|
||||||
|
Attenuation float64
|
||||||
|
Brightness float64
|
||||||
|
Enabled bool
|
||||||
|
}
|
||||||
|
|
||||||
|
type TokenBar struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
Attribute string
|
||||||
|
}
|
||||||
|
|
||||||
|
type TokenOccludable struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
Radius int
|
||||||
|
}
|
||||||
|
|
||||||
|
type TokenTurnMarker struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
Mode int
|
||||||
|
Animation string
|
||||||
|
Src string
|
||||||
|
Disposition bool
|
||||||
|
}
|
||||||
20
internal/foundry/temp_models/db/update.go
Normal file
20
internal/foundry/temp_models/db/update.go
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
package db
|
||||||
|
|
||||||
|
type CoreUpdate struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
HasUpdate bool
|
||||||
|
CanUpdate bool
|
||||||
|
CouldReachWebsite bool
|
||||||
|
SlowResponse bool
|
||||||
|
Version string
|
||||||
|
Channel string
|
||||||
|
WillDisableModules bool
|
||||||
|
}
|
||||||
|
|
||||||
|
type SystemUpdate struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
HasUpdate bool
|
||||||
|
Version string
|
||||||
|
}
|
||||||
21
internal/foundry/temp_models/db/user.go
Normal file
21
internal/foundry/temp_models/db/user.go
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
package db
|
||||||
|
|
||||||
|
type User struct {
|
||||||
|
ID string
|
||||||
|
|
||||||
|
Name string
|
||||||
|
Avatar string
|
||||||
|
Character string
|
||||||
|
Color string
|
||||||
|
Pronouns string
|
||||||
|
Role int
|
||||||
|
Stats Stats
|
||||||
|
Hotbar []UserHotbar
|
||||||
|
}
|
||||||
|
|
||||||
|
type UserHotbar struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
Key int
|
||||||
|
Value string
|
||||||
|
}
|
||||||
25
internal/foundry/temp_models/db/wall.go
Normal file
25
internal/foundry/temp_models/db/wall.go
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
package db
|
||||||
|
|
||||||
|
type Wall struct {
|
||||||
|
ID string
|
||||||
|
|
||||||
|
C []int
|
||||||
|
Light int
|
||||||
|
Move int
|
||||||
|
Sight int
|
||||||
|
Sound int
|
||||||
|
Dir int
|
||||||
|
Door int
|
||||||
|
Ds int
|
||||||
|
Threshold Threshold
|
||||||
|
Animation any
|
||||||
|
}
|
||||||
|
|
||||||
|
type Threshold struct {
|
||||||
|
ID uint
|
||||||
|
|
||||||
|
Light int
|
||||||
|
Sight int
|
||||||
|
Sound int
|
||||||
|
Attenuation bool
|
||||||
|
}
|
||||||
38
internal/foundry/temp_models/db/world.go
Normal file
38
internal/foundry/temp_models/db/world.go
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
package db
|
||||||
|
|
||||||
|
import "time"
|
||||||
|
|
||||||
|
type World struct {
|
||||||
|
ID string
|
||||||
|
|
||||||
|
Socket bool
|
||||||
|
Protected bool
|
||||||
|
Exclusive bool
|
||||||
|
PersistentStorage bool
|
||||||
|
Locked bool
|
||||||
|
Owned bool
|
||||||
|
HasStorage bool
|
||||||
|
Playtime int
|
||||||
|
Availability int
|
||||||
|
NextSession time.Time
|
||||||
|
Title string
|
||||||
|
Description string
|
||||||
|
Version string
|
||||||
|
System string
|
||||||
|
Background string
|
||||||
|
JoinTheme string
|
||||||
|
CoreVersion string
|
||||||
|
SystemVersion string
|
||||||
|
LastPlayed string
|
||||||
|
Tags []string
|
||||||
|
Scripts []string
|
||||||
|
Esmodules []string
|
||||||
|
Compatibility Compatibility
|
||||||
|
Relationships Relationships
|
||||||
|
Authors []Author
|
||||||
|
Media []Media
|
||||||
|
Styles []Style
|
||||||
|
Languages []Language
|
||||||
|
Packs []Pack
|
||||||
|
PackFolders []Folder
|
||||||
|
}
|
||||||
41
internal/foundry/temp_models/json/actor.go
Normal file
41
internal/foundry/temp_models/json/actor.go
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
package json
|
||||||
|
|
||||||
|
import "gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/temp_models/db"
|
||||||
|
|
||||||
|
type Actor struct {
|
||||||
|
PrototypeToken Token `json:"prototypeToken"`
|
||||||
|
Img string `json:"img"`
|
||||||
|
Items []*Item `json:"items"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Type string `json:"type"`
|
||||||
|
Folder string `json:"folder"`
|
||||||
|
Ownership map[string]int `json:"ownership,omitempty"`
|
||||||
|
Stats Stats `json:"_stats"`
|
||||||
|
Sort int `json:"sort"`
|
||||||
|
ID string `json:"_id"`
|
||||||
|
// System any `json:"system,omitempty"`
|
||||||
|
// Flags any `json:"flags,omitempty"`
|
||||||
|
// ActorsEffects []any `json:"effects"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Actor) ToDB(dest *db.Actor) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.Img = a.Img
|
||||||
|
dest.Name = a.Name
|
||||||
|
dest.Type = a.Type
|
||||||
|
dest.Folder = a.Folder
|
||||||
|
dest.Sort = a.Sort
|
||||||
|
dest.ID = a.ID
|
||||||
|
|
||||||
|
a.PrototypeToken.ToDB(&dest.PrototypeToken)
|
||||||
|
a.Stats.ToDB(&dest.Stats)
|
||||||
|
|
||||||
|
OwnershipToDB(&dest.Ownership, a.Ownership)
|
||||||
|
|
||||||
|
CopySliceToDB(&dest.Items, a.Items)
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
21
internal/foundry/temp_models/json/addresses.go
Normal file
21
internal/foundry/temp_models/json/addresses.go
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
package json
|
||||||
|
|
||||||
|
import "gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/temp_models/db"
|
||||||
|
|
||||||
|
type Addresses struct {
|
||||||
|
Local string `json:"local"`
|
||||||
|
Remote string `json:"remote"`
|
||||||
|
RemoteIsAccessible bool `json:"remoteIsAccessible"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Addresses) ToDB(dest *db.Addresses) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.Local = a.Local
|
||||||
|
dest.Remote = a.Remote
|
||||||
|
dest.RemoteIsAccessible = a.RemoteIsAccessible
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
24
internal/foundry/temp_models/json/authors.go
Normal file
24
internal/foundry/temp_models/json/authors.go
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
package json
|
||||||
|
|
||||||
|
import "gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/temp_models/db"
|
||||||
|
|
||||||
|
type Author struct {
|
||||||
|
Name string `json:"name"`
|
||||||
|
URL string `json:"url"`
|
||||||
|
Email string `json:"email,omitempty"`
|
||||||
|
Discord string `json:"discord,omitempty"`
|
||||||
|
// SystemAuthorsFlags SystemAuthorsFlags `json:"flags"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Author) ToDB(dest *db.Author) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.Name = a.Name
|
||||||
|
dest.URL = a.URL
|
||||||
|
dest.Email = a.Email
|
||||||
|
dest.Discord = a.Discord
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
130
internal/foundry/temp_models/json/card.go
Normal file
130
internal/foundry/temp_models/json/card.go
Normal file
@@ -0,0 +1,130 @@
|
|||||||
|
package json
|
||||||
|
|
||||||
|
import "gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/temp_models/db"
|
||||||
|
|
||||||
|
type CardDeck struct {
|
||||||
|
Name string `json:"name"`
|
||||||
|
Type string `json:"type"`
|
||||||
|
Description string `json:"description"`
|
||||||
|
Img string `json:"img"`
|
||||||
|
Cards []*Card `json:"cards"`
|
||||||
|
Width int `json:"width"`
|
||||||
|
Height int `json:"height"`
|
||||||
|
Rotation int `json:"rotation"`
|
||||||
|
DisplayCount bool `json:"displayCount"`
|
||||||
|
Stats Stats `json:"_stats"`
|
||||||
|
Ownership Ownership `json:"ownership"`
|
||||||
|
Folder string `json:"folder"`
|
||||||
|
Sort int `json:"sort"`
|
||||||
|
ID string `json:"_id"`
|
||||||
|
// Flags any `json:"flags"`
|
||||||
|
// Cards0System any `json:"system"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *CardDeck) ToDB(dest *db.CardDeck) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.Name = c.Name
|
||||||
|
dest.Type = c.Type
|
||||||
|
dest.Description = c.Description
|
||||||
|
dest.Img = c.Img
|
||||||
|
dest.Width = c.Width
|
||||||
|
dest.Height = c.Height
|
||||||
|
dest.Rotation = c.Rotation
|
||||||
|
dest.DisplayCount = c.DisplayCount
|
||||||
|
dest.Folder = c.Folder
|
||||||
|
dest.Sort = c.Sort
|
||||||
|
dest.ID = c.ID
|
||||||
|
|
||||||
|
c.Stats.ToDB(&dest.Stats)
|
||||||
|
c.Ownership.ToDB(&dest.Ownership)
|
||||||
|
|
||||||
|
CopySliceToDB(&dest.Cards, c.Cards)
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
type Card struct {
|
||||||
|
Name string `json:"name"`
|
||||||
|
Faces []*Face `json:"faces"`
|
||||||
|
Width int `json:"width"`
|
||||||
|
Height int `json:"height"`
|
||||||
|
Rotation int `json:"rotation"`
|
||||||
|
Type string `json:"type"`
|
||||||
|
Value int `json:"value"`
|
||||||
|
Suit string `json:"suit"`
|
||||||
|
Description string `json:"description"`
|
||||||
|
Face int `json:"face"`
|
||||||
|
Drawn bool `json:"drawn"`
|
||||||
|
Sort int `json:"sort"`
|
||||||
|
Back Back `json:"back"`
|
||||||
|
Origin string `json:"origin"`
|
||||||
|
ID string `json:"_id"`
|
||||||
|
Stats Stats `json:"_stats"`
|
||||||
|
// Flags any `json:"flags"`
|
||||||
|
// System any `json:"system"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Card) ToDB(dest *db.Card) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.Name = c.Name
|
||||||
|
dest.Width = c.Width
|
||||||
|
dest.Height = c.Height
|
||||||
|
dest.Rotation = c.Rotation
|
||||||
|
dest.Type = c.Type
|
||||||
|
dest.Value = c.Value
|
||||||
|
dest.Suit = c.Suit
|
||||||
|
dest.Description = c.Description
|
||||||
|
dest.Face = c.Face
|
||||||
|
dest.Drawn = c.Drawn
|
||||||
|
dest.Origin = c.Origin
|
||||||
|
dest.ID = c.ID
|
||||||
|
dest.Sort = c.Sort
|
||||||
|
|
||||||
|
c.Back.ToDB(&dest.Back)
|
||||||
|
c.Stats.ToDB(&dest.Stats)
|
||||||
|
|
||||||
|
CopySliceToDB(&dest.Faces, c.Faces)
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
type Face struct {
|
||||||
|
Name string `json:"name"`
|
||||||
|
Img string `json:"img"`
|
||||||
|
Text string `json:"text"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *Face) ToDB(dest *db.Face) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.Name = f.Name
|
||||||
|
dest.Img = f.Img
|
||||||
|
dest.Text = f.Text
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
type Back struct {
|
||||||
|
Img any `json:"img"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Text string `json:"text"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (b *Back) ToDB(dest *db.Back) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.Name = b.Name
|
||||||
|
dest.Text = b.Text
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
75
internal/foundry/temp_models/json/combat.go
Normal file
75
internal/foundry/temp_models/json/combat.go
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
package json
|
||||||
|
|
||||||
|
import "gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/temp_models/db"
|
||||||
|
|
||||||
|
type Combat struct {
|
||||||
|
Id string `json:"_id"`
|
||||||
|
Type string `json:"type"`
|
||||||
|
Scene string `json:"scene"`
|
||||||
|
Groups []string `json:"groups"`
|
||||||
|
Combatants []*Combatant `json:"combatants"`
|
||||||
|
Active bool `json:"active"`
|
||||||
|
Round int `json:"round"`
|
||||||
|
Turn int `json:"turn"`
|
||||||
|
Sort int `json:"sort"`
|
||||||
|
Stats Stats `json:"stats"`
|
||||||
|
// System any `json:"system"`
|
||||||
|
// Flags any `json:"flags"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Combat) ToDB(dest *db.Combat) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.ID = c.Id
|
||||||
|
dest.Type = c.Type
|
||||||
|
dest.Scene = c.Scene
|
||||||
|
dest.Active = c.Active
|
||||||
|
dest.Round = c.Round
|
||||||
|
dest.Turn = c.Turn
|
||||||
|
dest.Sort = c.Sort
|
||||||
|
|
||||||
|
c.Stats.ToDB(&dest.Stats)
|
||||||
|
|
||||||
|
copy(dest.Groups, c.Groups)
|
||||||
|
CopySliceToDB(&dest.Combatants, c.Combatants)
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
type Combatant struct {
|
||||||
|
TokenId string `json:"tokenId"`
|
||||||
|
SceneId string `json:"sceneId"`
|
||||||
|
ActorId string `json:"actorId"`
|
||||||
|
Hidden bool `json:"hidden"`
|
||||||
|
Id string `json:"_id"`
|
||||||
|
Type string `json:"type"`
|
||||||
|
Img string `json:"img"`
|
||||||
|
Initiative int `json:"initiative"`
|
||||||
|
Defeated bool `json:"defeated"`
|
||||||
|
Group string `json:"group"`
|
||||||
|
Stats Stats `json:"stats"`
|
||||||
|
// System any `json:"system"`
|
||||||
|
// Flags any `json:"flags"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Combatant) ToDB(dest *db.Combatant) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.TokenId = c.TokenId
|
||||||
|
dest.SceneId = c.SceneId
|
||||||
|
dest.ActorId = c.ActorId
|
||||||
|
dest.Hidden = c.Hidden
|
||||||
|
dest.ID = c.Id
|
||||||
|
dest.Type = c.Type
|
||||||
|
dest.Img = c.Img
|
||||||
|
dest.Initiative = c.Initiative
|
||||||
|
dest.Defeated = c.Defeated
|
||||||
|
dest.Group = c.Group
|
||||||
|
c.Stats.ToDB(&dest.Stats)
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
21
internal/foundry/temp_models/json/compatibility.go
Normal file
21
internal/foundry/temp_models/json/compatibility.go
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
package json
|
||||||
|
|
||||||
|
import "gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/temp_models/db"
|
||||||
|
|
||||||
|
type Compatibility struct {
|
||||||
|
Minimum string `json:"minimum,omitempty"`
|
||||||
|
Verified string `json:"verified,omitempty"`
|
||||||
|
Maximum string `json:"maximum,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Compatibility) ToDB(dest *db.Compatibility) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.Minimum = c.Minimum
|
||||||
|
dest.Verified = c.Verified
|
||||||
|
dest.Maximum = c.Maximum
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
17
internal/foundry/temp_models/json/details_language.go
Normal file
17
internal/foundry/temp_models/json/details_language.go
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
package json
|
||||||
|
|
||||||
|
import "gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/temp_models/db"
|
||||||
|
|
||||||
|
type DetailsLanguages struct {
|
||||||
|
Details string `json:"details"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *DetailsLanguages) ToDB(dest *db.DetailsLanguages) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.Details = d.Details
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
39
internal/foundry/temp_models/json/document_types.go
Normal file
39
internal/foundry/temp_models/json/document_types.go
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
package json
|
||||||
|
|
||||||
|
import "gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/temp_models/db"
|
||||||
|
|
||||||
|
type DocumentTypes struct {
|
||||||
|
Actor DocumentTypeData `json:"Actor"`
|
||||||
|
Item DocumentTypeData `json:"Item"`
|
||||||
|
RegionBehavior RegionBehavior `json:"RegionBehavior,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *DocumentTypes) ToDB(dest *db.DocumentTypes) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.Data = make([]db.DocumentTypeData, 2)
|
||||||
|
|
||||||
|
d.Actor.ToDB(&dest.Data[0])
|
||||||
|
dest.Data[0].Type = "Actor"
|
||||||
|
|
||||||
|
d.Item.ToDB(&dest.Data[1])
|
||||||
|
dest.Data[1].Type = "Item"
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
type DocumentTypeData struct {
|
||||||
|
HtmlFields []string `json:"htmlFields"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *DocumentTypeData) ToDB(dest *db.DocumentTypeData) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.HtmlFields = d.HtmlFields
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
97
internal/foundry/temp_models/json/environment.go
Normal file
97
internal/foundry/temp_models/json/environment.go
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
package json
|
||||||
|
|
||||||
|
import "gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/temp_models/db"
|
||||||
|
|
||||||
|
type Environment struct {
|
||||||
|
GlobalLight EnvironmentGlobalLight `json:"globalLight"`
|
||||||
|
DarknessLevel float64 `json:"darknessLevel"`
|
||||||
|
DarknessLock bool `json:"darknessLock"`
|
||||||
|
Cycle bool `json:"cycle"`
|
||||||
|
ScenesEnvironmentBase EnvironmentBase `json:"base"`
|
||||||
|
Dark EnvironmentBase `json:"dark"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Environment) ToDB(dest *db.Environment) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
e.GlobalLight.ToDB(&dest.GlobalLight)
|
||||||
|
dest.DarknessLevel = e.DarknessLevel
|
||||||
|
dest.DarknessLock = e.DarknessLock
|
||||||
|
dest.Cycle = e.Cycle
|
||||||
|
e.ScenesEnvironmentBase.ToDB(&dest.ScenesEnvironmentBase)
|
||||||
|
e.Dark.ToDB(&dest.Dark)
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
type EnvironmentGlobalLight struct {
|
||||||
|
Enabled bool `json:"enabled"`
|
||||||
|
Darkness GlobalLightDarkness `json:"darkness"`
|
||||||
|
Alpha float64 `json:"alpha"`
|
||||||
|
Bright bool `json:"bright"`
|
||||||
|
Color string `json:"color"`
|
||||||
|
Coloration float64 `json:"coloration"`
|
||||||
|
Luminosity float64 `json:"luminosity"`
|
||||||
|
Saturation float64 `json:"saturation"`
|
||||||
|
Contrast float64 `json:"contrast"`
|
||||||
|
Shadows float64 `json:"shadows"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *EnvironmentGlobalLight) ToDB(dest *db.EnvironmentGlobalLight) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.Enabled = e.Enabled
|
||||||
|
e.Darkness.ToDB(&dest.Darkness)
|
||||||
|
dest.Alpha = e.Alpha
|
||||||
|
dest.Bright = e.Bright
|
||||||
|
dest.Color = e.Color
|
||||||
|
dest.Coloration = e.Coloration
|
||||||
|
dest.Luminosity = e.Luminosity
|
||||||
|
dest.Saturation = e.Saturation
|
||||||
|
dest.Contrast = e.Contrast
|
||||||
|
dest.Shadows = e.Shadows
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
type EnvironmentBase struct {
|
||||||
|
Hue float64 `json:"hue"`
|
||||||
|
Intensity float64 `json:"intensity"`
|
||||||
|
Luminosity float64 `json:"luminosity"`
|
||||||
|
Saturation float64 `json:"saturation"`
|
||||||
|
Shadows float64 `json:"shadows"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *EnvironmentBase) ToDB(dest *db.EnvironmentBase) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.Hue = e.Hue
|
||||||
|
dest.Intensity = e.Intensity
|
||||||
|
dest.Luminosity = e.Luminosity
|
||||||
|
dest.Saturation = e.Saturation
|
||||||
|
dest.Shadows = e.Shadows
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
type GlobalLightDarkness struct {
|
||||||
|
Max int `json:"max"`
|
||||||
|
Min int `json:"min"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GlobalLightDarkness) ToDB(dest *db.GlobalLightDarkness) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.Max = g.Max
|
||||||
|
dest.Min = g.Min
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
18
internal/foundry/temp_models/json/files.go
Normal file
18
internal/foundry/temp_models/json/files.go
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
package json
|
||||||
|
|
||||||
|
import "gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/temp_models/db"
|
||||||
|
|
||||||
|
type Files struct {
|
||||||
|
Storages []string `json:"storages"`
|
||||||
|
S3 any `json:"s3"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *Files) ToDB(dest *db.Files) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
copy(dest.Storages, f.Storages)
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
57
internal/foundry/temp_models/json/folder.go
Normal file
57
internal/foundry/temp_models/json/folder.go
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
package json
|
||||||
|
|
||||||
|
import "gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/temp_models/db"
|
||||||
|
|
||||||
|
type Folder struct {
|
||||||
|
Name string `json:"name"`
|
||||||
|
Sorting string `json:"sorting"`
|
||||||
|
Color string `json:"color,omitempty"`
|
||||||
|
Packs []string `json:"packs"`
|
||||||
|
Folders []*Folder `json:"folders,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *Folder) ToDB(dest *db.Folder) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.Name = f.Name
|
||||||
|
dest.Sorting = f.Sorting
|
||||||
|
dest.Color = f.Color
|
||||||
|
copy(dest.Packs, f.Packs)
|
||||||
|
|
||||||
|
CopySliceToDB(&dest.Folders, f.Folders)
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
type WorldFolder struct {
|
||||||
|
Name string `json:"name"`
|
||||||
|
Type string `json:"type"`
|
||||||
|
ID string `json:"_id"`
|
||||||
|
Folder string `json:"folder"`
|
||||||
|
Sorting string `json:"sorting"`
|
||||||
|
Sort int `json:"sort"`
|
||||||
|
Stats Stats `json:"_stats,omitempty"`
|
||||||
|
Description string `json:"description"`
|
||||||
|
Color string `json:"color"`
|
||||||
|
// Flags any `json:"flags,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *WorldFolder) ToDB(dest *db.WorldFolder) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.Name = w.Name
|
||||||
|
dest.Type = w.Type
|
||||||
|
dest.ID = w.ID
|
||||||
|
dest.Folder = w.Folder
|
||||||
|
dest.Sorting = w.Sorting
|
||||||
|
dest.Sort = w.Sort
|
||||||
|
w.Stats.ToDB(&dest.Stats)
|
||||||
|
dest.Description = w.Description
|
||||||
|
dest.Color = w.Color
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
79
internal/foundry/temp_models/json/game.go
Normal file
79
internal/foundry/temp_models/json/game.go
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
package json
|
||||||
|
|
||||||
|
import (
|
||||||
|
"sync"
|
||||||
|
|
||||||
|
"gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/temp_models/db"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Game struct {
|
||||||
|
UserID string `json:"userId"`
|
||||||
|
Release Release `json:"release"`
|
||||||
|
World World `json:"world"`
|
||||||
|
System System `json:"system"`
|
||||||
|
Modules []*Module `json:"modules"`
|
||||||
|
DemoMode bool `json:"demoMode"`
|
||||||
|
IdleLogout bool `json:"idleLogout"`
|
||||||
|
Addresses Addresses `json:"addresses"`
|
||||||
|
Files Files `json:"files"`
|
||||||
|
Options GameOptions `json:"options"`
|
||||||
|
ActiveUsers []string `json:"activeUsers"`
|
||||||
|
Paused bool `json:"paused"`
|
||||||
|
PackageWarnings map[string]PackageWarningsData `json:"packageWarnings"`
|
||||||
|
Packs []*Pack `json:"packs"`
|
||||||
|
Messages []*Message `json:"messages,omitempty"`
|
||||||
|
Combats []*Combat `json:"combats"`
|
||||||
|
CardDeck []*CardDeck `json:"cards"`
|
||||||
|
Users []*User `json:"users"`
|
||||||
|
Macros []*Macro `json:"macros"`
|
||||||
|
Folders []*WorldFolder `json:"folders"`
|
||||||
|
Items []*Item `json:"items"`
|
||||||
|
Settings []*Setting `json:"settings"`
|
||||||
|
Journals []*Journal `json:"journal"`
|
||||||
|
Tables []*Table `json:"tables"`
|
||||||
|
Playlists []*Playlist `json:"playlists"`
|
||||||
|
Scenes []*Scene `json:"scenes"`
|
||||||
|
Actors []*Actor `json:"actors"`
|
||||||
|
CoreUpdate CoreUpdate `json:"coreUpdate"`
|
||||||
|
SystemUpdate SystemUpdate `json:"systemUpdate"`
|
||||||
|
// Model Model `json:"model"`
|
||||||
|
// Template Template `json:"template"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *Game) ToDB(dest *db.Game) bool {
|
||||||
|
dest.UserID = g.UserID
|
||||||
|
dest.DemoMode = g.DemoMode
|
||||||
|
dest.IdleLogout = g.IdleLogout
|
||||||
|
dest.Paused = g.Paused
|
||||||
|
PackageWarningsToDB(&dest.PackageWarnings, g.PackageWarnings)
|
||||||
|
|
||||||
|
g.Addresses.ToDB(&dest.Addresses)
|
||||||
|
g.Files.ToDB(&dest.Files)
|
||||||
|
g.Release.ToDB(&dest.Release)
|
||||||
|
g.World.ToDB(&dest.World)
|
||||||
|
g.System.ToDB(&dest.System)
|
||||||
|
g.Options.ToDB(&dest.Options)
|
||||||
|
g.CoreUpdate.ToDB(&dest.CoreUpdate)
|
||||||
|
g.SystemUpdate.ToDB(&dest.SystemUpdate)
|
||||||
|
copy(dest.ActiveUsers, g.ActiveUsers)
|
||||||
|
|
||||||
|
wg := sync.WaitGroup{}
|
||||||
|
go CopySliceToDBParallel(&wg, &dest.Modules, g.Modules)
|
||||||
|
go CopySliceToDBParallel(&wg, &dest.Packs, g.Packs)
|
||||||
|
go CopySliceToDBParallel(&wg, &dest.Messages, g.Messages)
|
||||||
|
go CopySliceToDBParallel(&wg, &dest.Combats, g.Combats)
|
||||||
|
go CopySliceToDBParallel(&wg, &dest.CardDeck, g.CardDeck)
|
||||||
|
go CopySliceToDBParallel(&wg, &dest.Users, g.Users)
|
||||||
|
go CopySliceToDBParallel(&wg, &dest.Macros, g.Macros)
|
||||||
|
go CopySliceToDBParallel(&wg, &dest.Folders, g.Folders)
|
||||||
|
go CopySliceToDBParallel(&wg, &dest.Items, g.Items)
|
||||||
|
go CopySliceToDBParallel(&wg, &dest.Settings, g.Settings)
|
||||||
|
go CopySliceToDBParallel(&wg, &dest.Journals, g.Journals)
|
||||||
|
go CopySliceToDBParallel(&wg, &dest.Tables, g.Tables)
|
||||||
|
go CopySliceToDBParallel(&wg, &dest.Playlists, g.Playlists)
|
||||||
|
go CopySliceToDBParallel(&wg, &dest.Actors, g.Actors)
|
||||||
|
// go CopySliceToDBParallel(&wg, &dest.Scenes, g.Scenes)
|
||||||
|
wg.Wait()
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
33
internal/foundry/temp_models/json/grid.go
Normal file
33
internal/foundry/temp_models/json/grid.go
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
package json
|
||||||
|
|
||||||
|
import "gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/temp_models/db"
|
||||||
|
|
||||||
|
type Grid struct {
|
||||||
|
Type int `json:"type"`
|
||||||
|
Size int `json:"size,omitempty"`
|
||||||
|
Color string `json:"color,omitempty"`
|
||||||
|
Alpha float64 `json:"alpha,omitempty"`
|
||||||
|
Distance int `json:"distance"`
|
||||||
|
Units string `json:"units"`
|
||||||
|
Diagonals int `json:"diagonals,omitempty"`
|
||||||
|
Style string `json:"style,omitempty"`
|
||||||
|
Thickness int `json:"thickness,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *Grid) ToDB(dest *db.Grid) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.Type = g.Type
|
||||||
|
dest.Size = g.Size
|
||||||
|
dest.Color = g.Color
|
||||||
|
dest.Alpha = g.Alpha
|
||||||
|
dest.Distance = g.Distance
|
||||||
|
dest.Units = g.Units
|
||||||
|
dest.Diagonals = g.Diagonals
|
||||||
|
dest.Style = g.Style
|
||||||
|
dest.Thickness = g.Thickness
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
25
internal/foundry/temp_models/json/index.go
Normal file
25
internal/foundry/temp_models/json/index.go
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
package json
|
||||||
|
|
||||||
|
import "gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/temp_models/db"
|
||||||
|
|
||||||
|
type Index struct {
|
||||||
|
Id string `json:"_id"`
|
||||||
|
Folder string `json:"folder"`
|
||||||
|
Img string `json:"img"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Type string `json:"type"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i *Index) ToDB(dest *db.Index) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.ID = i.Id
|
||||||
|
dest.Folder = i.Folder
|
||||||
|
dest.Img = i.Img
|
||||||
|
dest.Name = i.Name
|
||||||
|
dest.Type = i.Type
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
34
internal/foundry/temp_models/json/item.go
Normal file
34
internal/foundry/temp_models/json/item.go
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
package json
|
||||||
|
|
||||||
|
import "gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/temp_models/db"
|
||||||
|
|
||||||
|
type Item struct {
|
||||||
|
Img string `json:"img"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Type string `json:"type"`
|
||||||
|
Folder string `json:"folder"`
|
||||||
|
Ownership map[string]int `json:"ownership"`
|
||||||
|
Stats Stats `json:"_stats"`
|
||||||
|
ID string `json:"_id"`
|
||||||
|
Sort int `json:"sort"`
|
||||||
|
// System any `json:"system,omitempty"`
|
||||||
|
// Flags any `json:"flags,omitempty"`
|
||||||
|
// Effects []any `json:"effects"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i *Item) ToDB(dest *db.Item) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.Img = i.Img
|
||||||
|
dest.Name = i.Name
|
||||||
|
dest.Type = i.Type
|
||||||
|
dest.Folder = i.Folder
|
||||||
|
dest.ID = i.ID
|
||||||
|
dest.Sort = i.Sort
|
||||||
|
|
||||||
|
i.Stats.ToDB(&dest.Stats)
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
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
|
||||||
|
}
|
||||||
91
internal/foundry/temp_models/json/journal_page.go
Normal file
91
internal/foundry/temp_models/json/journal_page.go
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
package json
|
||||||
|
|
||||||
|
import "gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/temp_models/db"
|
||||||
|
|
||||||
|
type JournalPage struct {
|
||||||
|
Name string `json:"name"`
|
||||||
|
Type string `json:"type"`
|
||||||
|
Text PageText `json:"text,omitempty"`
|
||||||
|
ID string `json:"_id"`
|
||||||
|
Title PageTitle `json:"title"`
|
||||||
|
Video PageVideo `json:"video"`
|
||||||
|
Src string `json:"src"`
|
||||||
|
Sort int `json:"sort"`
|
||||||
|
Ownership map[string]int `json:"ownership"`
|
||||||
|
Stats Stats `json:"_stats,omitempty"`
|
||||||
|
// System PagesSystem `json:"system"`
|
||||||
|
// Image any `json:"image"`
|
||||||
|
// Flags any `json:"flags"`
|
||||||
|
// Category any `json:"category"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (j *JournalPage) ToDB(dest *db.JournalPage) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.Name = j.Name
|
||||||
|
dest.Type = j.Type
|
||||||
|
dest.ID = j.ID
|
||||||
|
dest.Src = j.Src
|
||||||
|
dest.Sort = j.Sort
|
||||||
|
|
||||||
|
j.Text.ToDB(&dest.Text)
|
||||||
|
j.Title.ToDB(&dest.Title)
|
||||||
|
j.Video.ToDB(&dest.Video)
|
||||||
|
j.Stats.ToDB(&dest.Stats)
|
||||||
|
|
||||||
|
OwnershipToDB(&dest.Ownership, j.Ownership)
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
type PageText struct {
|
||||||
|
Content string `json:"content"`
|
||||||
|
Format int `json:"format"`
|
||||||
|
Markdown string `json:"markdown,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *PageText) ToDB(dest *db.PageText) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.Content = p.Content
|
||||||
|
dest.Format = p.Format
|
||||||
|
dest.Markdown = p.Markdown
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
type PageTitle struct {
|
||||||
|
Show bool `json:"show"`
|
||||||
|
Level int `json:"level"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *PageTitle) ToDB(dest *db.PageTitle) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.Show = p.Show
|
||||||
|
dest.Level = p.Level
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
type PageVideo struct {
|
||||||
|
Controls bool `json:"controls"`
|
||||||
|
Volume float64 `json:"volume"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *PageVideo) ToDB(dest *db.PageVideo) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.Controls = p.Controls
|
||||||
|
dest.Volume = p.Volume
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
59
internal/foundry/temp_models/json/language.go
Normal file
59
internal/foundry/temp_models/json/language.go
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
package json
|
||||||
|
|
||||||
|
import "gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/temp_models/db"
|
||||||
|
|
||||||
|
type Language struct {
|
||||||
|
Lang string `json:"lang"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Path string `json:"path"`
|
||||||
|
// SystemLanguagesFlags SystemLanguagesFlags `json:"flags"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l *Language) ToDB(dest *db.Language) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.Lang = l.Lang
|
||||||
|
dest.Name = l.Name
|
||||||
|
dest.Path = l.Path
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
type SetupLanguage struct {
|
||||||
|
ID string `json:"id"`
|
||||||
|
Label string `json:"label"`
|
||||||
|
Modules []*SetupLanguageModule `json:"modules"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *SetupLanguage) ToDB(dest *db.SetupLanguage) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.ID = s.ID
|
||||||
|
dest.Label = s.Label
|
||||||
|
|
||||||
|
CopySliceToDB(&dest.Modules, s.Modules)
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
type SetupLanguageModule struct {
|
||||||
|
ID string `json:"id"`
|
||||||
|
Label string `json:"label"`
|
||||||
|
Path string `json:"path"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *SetupLanguageModule) ToDB(dest *db.SetupLanguageModule) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.ID = s.ID
|
||||||
|
dest.Label = s.Label
|
||||||
|
dest.Path = s.Path
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
81
internal/foundry/temp_models/json/light.go
Normal file
81
internal/foundry/temp_models/json/light.go
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
package json
|
||||||
|
|
||||||
|
import "gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/temp_models/db"
|
||||||
|
|
||||||
|
type Light struct {
|
||||||
|
Alpha float64 `json:"alpha"`
|
||||||
|
Angle int `json:"angle"`
|
||||||
|
Bright float64 `json:"bright"`
|
||||||
|
Coloration float64 `json:"coloration"`
|
||||||
|
Dim float64 `json:"dim"`
|
||||||
|
Attenuation float64 `json:"attenuation"`
|
||||||
|
Luminosity float64 `json:"luminosity"`
|
||||||
|
Saturation float64 `json:"saturation"`
|
||||||
|
Contrast float64 `json:"contrast"`
|
||||||
|
Shadows float64 `json:"shadows"`
|
||||||
|
LightAnimation LightAnimation `json:"animation"`
|
||||||
|
LightDarkness LightDarkness `json:"darkness"`
|
||||||
|
Negative bool `json:"negative"`
|
||||||
|
Priority int `json:"priority"`
|
||||||
|
Color string `json:"color"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l *Light) ToDB(dest *db.Light) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.Alpha = l.Alpha
|
||||||
|
dest.Angle = l.Angle
|
||||||
|
dest.Bright = l.Bright
|
||||||
|
dest.Coloration = l.Coloration
|
||||||
|
dest.Dim = l.Dim
|
||||||
|
dest.Attenuation = l.Attenuation
|
||||||
|
dest.Luminosity = l.Luminosity
|
||||||
|
dest.Saturation = l.Saturation
|
||||||
|
dest.Contrast = l.Contrast
|
||||||
|
dest.Shadows = l.Shadows
|
||||||
|
dest.Negative = l.Negative
|
||||||
|
dest.Priority = l.Priority
|
||||||
|
dest.Color = l.Color
|
||||||
|
|
||||||
|
l.LightAnimation.ToDB(&dest.LightAnimation)
|
||||||
|
l.LightDarkness.ToDB(&dest.LightDarkness)
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
type LightAnimation struct {
|
||||||
|
Type any `json:"type"`
|
||||||
|
Speed int `json:"speed"`
|
||||||
|
Intensity int `json:"intensity"`
|
||||||
|
Reverse bool `json:"reverse"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l *LightAnimation) ToDB(dest *db.LightAnimation) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.Speed = l.Speed
|
||||||
|
dest.Intensity = l.Intensity
|
||||||
|
dest.Reverse = l.Reverse
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
type LightDarkness struct {
|
||||||
|
Min float64 `json:"min"`
|
||||||
|
Max float64 `json:"max"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l *LightDarkness) ToDB(dest *db.LightDarkness) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.Min = l.Min
|
||||||
|
dest.Max = l.Max
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
40
internal/foundry/temp_models/json/macro.go
Normal file
40
internal/foundry/temp_models/json/macro.go
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
package json
|
||||||
|
|
||||||
|
import "gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/temp_models/db"
|
||||||
|
|
||||||
|
type Macro struct {
|
||||||
|
Command string `json:"command"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Type string `json:"type"`
|
||||||
|
Img string `json:"img"`
|
||||||
|
ID string `json:"_id"`
|
||||||
|
Author string `json:"author"`
|
||||||
|
Scope string `json:"scope"`
|
||||||
|
Folder string `json:"folder"`
|
||||||
|
Sort int `json:"sort"`
|
||||||
|
Ownership map[string]int `json:"ownership,omitempty"`
|
||||||
|
Stats Stats `json:"_stats"`
|
||||||
|
// Flags any `json:"flags,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Macro) ToDB(dest *db.Macro) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.Command = m.Command
|
||||||
|
dest.Name = m.Name
|
||||||
|
dest.Type = m.Type
|
||||||
|
dest.Img = m.Img
|
||||||
|
dest.ID = m.ID
|
||||||
|
dest.Author = m.Author
|
||||||
|
dest.Scope = m.Scope
|
||||||
|
dest.Folder = m.Folder
|
||||||
|
dest.Sort = m.Sort
|
||||||
|
|
||||||
|
m.Stats.ToDB(&dest.Stats)
|
||||||
|
|
||||||
|
OwnershipToDB(&dest.Ownership, m.Ownership)
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
21
internal/foundry/temp_models/json/media.go
Normal file
21
internal/foundry/temp_models/json/media.go
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
package json
|
||||||
|
|
||||||
|
import "gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/temp_models/db"
|
||||||
|
|
||||||
|
type Media struct {
|
||||||
|
Type string `json:"type"`
|
||||||
|
URL string `json:"url"`
|
||||||
|
Caption string `json:"caption"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Media) ToDB(dest *db.Media) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.Type = m.Type
|
||||||
|
dest.URL = m.URL
|
||||||
|
dest.Caption = m.Caption
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
67
internal/foundry/temp_models/json/message.go
Normal file
67
internal/foundry/temp_models/json/message.go
Normal 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
|
||||||
|
}
|
||||||
93
internal/foundry/temp_models/json/module.go
Normal file
93
internal/foundry/temp_models/json/module.go
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
package json
|
||||||
|
|
||||||
|
import (
|
||||||
|
"sync"
|
||||||
|
|
||||||
|
"gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/temp_models/db"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Module struct {
|
||||||
|
ID string `json:"id"`
|
||||||
|
Title string `json:"title"`
|
||||||
|
Description string `json:"description"`
|
||||||
|
Authors []*Author `json:"authors"`
|
||||||
|
URL string `json:"url,omitempty"`
|
||||||
|
License string `json:"license,omitempty"`
|
||||||
|
Readme string `json:"readme,omitempty"`
|
||||||
|
Bugs string `json:"bugs,omitempty"`
|
||||||
|
Changelog string `json:"changelog,omitempty"`
|
||||||
|
Media []*Media `json:"media"`
|
||||||
|
Version string `json:"version"`
|
||||||
|
Compatibility Compatibility `json:"compatibility,omitempty"`
|
||||||
|
Scripts []string `json:"scripts"`
|
||||||
|
Esmodules []string `json:"esmodules"`
|
||||||
|
Styles []*Style `json:"styles"`
|
||||||
|
Languages []*Language `json:"languages"`
|
||||||
|
Packs []*Pack `json:"packs"`
|
||||||
|
PackFolders []*Folder `json:"packFolders"`
|
||||||
|
Relationships Relationships `json:"relationships"`
|
||||||
|
Socket bool `json:"socket"`
|
||||||
|
Manifest string `json:"manifest,omitempty"`
|
||||||
|
Download string `json:"download,omitempty"`
|
||||||
|
Protected bool `json:"protected"`
|
||||||
|
Exclusive bool `json:"exclusive"`
|
||||||
|
PersistentStorage bool `json:"persistentStorage"`
|
||||||
|
CoreTranslation bool `json:"coreTranslation"`
|
||||||
|
Library bool `json:"library"`
|
||||||
|
DocumentTypes DocumentTypes `json:"documentTypes"`
|
||||||
|
Availability int `json:"availability"`
|
||||||
|
Locked bool `json:"locked"`
|
||||||
|
Owned bool `json:"owned"`
|
||||||
|
Tags []string `json:"tags"`
|
||||||
|
HasStorage bool `json:"hasStorage"`
|
||||||
|
Active bool `json:"active,omitempty"`
|
||||||
|
// ModulesFlags ModulesFlags `json:"flags,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Module) ToDB(dest *db.Module) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.ID = m.ID
|
||||||
|
dest.Title = m.Title
|
||||||
|
dest.Description = m.Description
|
||||||
|
dest.URL = m.URL
|
||||||
|
dest.License = m.License
|
||||||
|
dest.Readme = m.Readme
|
||||||
|
dest.Bugs = m.Bugs
|
||||||
|
dest.Changelog = m.Changelog
|
||||||
|
dest.Version = m.Version
|
||||||
|
dest.Socket = m.Socket
|
||||||
|
dest.Manifest = m.Manifest
|
||||||
|
dest.Download = m.Download
|
||||||
|
dest.Protected = m.Protected
|
||||||
|
dest.Exclusive = m.Exclusive
|
||||||
|
dest.PersistentStorage = m.PersistentStorage
|
||||||
|
dest.CoreTranslation = m.CoreTranslation
|
||||||
|
dest.Library = m.Library
|
||||||
|
dest.Availability = m.Availability
|
||||||
|
dest.Locked = m.Locked
|
||||||
|
dest.Owned = m.Owned
|
||||||
|
dest.HasStorage = m.HasStorage
|
||||||
|
dest.Active = m.Active
|
||||||
|
|
||||||
|
copy(dest.Scripts, m.Scripts)
|
||||||
|
copy(dest.Esmodules, m.Esmodules)
|
||||||
|
copy(dest.Tags, m.Tags)
|
||||||
|
|
||||||
|
m.Compatibility.ToDB(&dest.Compatibility)
|
||||||
|
m.Relationships.ToDB(&dest.Relationships)
|
||||||
|
m.DocumentTypes.ToDB(&dest.DocumentTypes)
|
||||||
|
|
||||||
|
wg := sync.WaitGroup{}
|
||||||
|
go CopySliceToDBParallel(&wg, &dest.Authors, m.Authors)
|
||||||
|
go CopySliceToDBParallel(&wg, &dest.Media, m.Media)
|
||||||
|
go CopySliceToDBParallel(&wg, &dest.Styles, m.Styles)
|
||||||
|
go CopySliceToDBParallel(&wg, &dest.Languages, m.Languages)
|
||||||
|
go CopySliceToDBParallel(&wg, &dest.Packs, m.Packs)
|
||||||
|
go CopySliceToDBParallel(&wg, &dest.PackFolders, m.PackFolders)
|
||||||
|
wg.Wait()
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
81
internal/foundry/temp_models/json/notes.go
Normal file
81
internal/foundry/temp_models/json/notes.go
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
package json
|
||||||
|
|
||||||
|
import "gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/temp_models/db"
|
||||||
|
|
||||||
|
type Note struct {
|
||||||
|
EntryID string `json:"entryId"`
|
||||||
|
PageID string `json:"pageId"`
|
||||||
|
Text string `json:"text"`
|
||||||
|
X float64 `json:"x"`
|
||||||
|
Y float64 `json:"y"`
|
||||||
|
Global bool `json:"global"`
|
||||||
|
IconSize int `json:"iconSize"`
|
||||||
|
Texture NoteTexture `json:"texture"`
|
||||||
|
FontFamily string `json:"fontFamily"`
|
||||||
|
FontSize int `json:"fontSize"`
|
||||||
|
TextColor string `json:"textColor"`
|
||||||
|
TextAnchor int `json:"textAnchor"`
|
||||||
|
ID string `json:"_id"`
|
||||||
|
Elevation int `json:"elevation"`
|
||||||
|
Sort int `json:"sort"`
|
||||||
|
// NotesFlags any `json:"flags"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (n *Note) ToDB(dest *db.Note) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.EntryID = n.EntryID
|
||||||
|
dest.PageID = n.PageID
|
||||||
|
dest.Text = n.Text
|
||||||
|
dest.X = n.X
|
||||||
|
dest.Y = n.Y
|
||||||
|
dest.Global = n.Global
|
||||||
|
dest.IconSize = n.IconSize
|
||||||
|
dest.FontFamily = n.FontFamily
|
||||||
|
dest.FontSize = n.FontSize
|
||||||
|
dest.TextColor = n.TextColor
|
||||||
|
dest.TextAnchor = n.TextAnchor
|
||||||
|
dest.ID = n.ID
|
||||||
|
dest.Elevation = n.Elevation
|
||||||
|
dest.Sort = n.Sort
|
||||||
|
|
||||||
|
n.Texture.ToDB(&dest.Texture)
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
type NoteTexture struct {
|
||||||
|
Tint string `json:"tint"`
|
||||||
|
Src string `json:"src"`
|
||||||
|
ScaleX int `json:"scaleX"`
|
||||||
|
ScaleY int `json:"scaleY"`
|
||||||
|
OffsetX float64 `json:"offsetX"`
|
||||||
|
OffsetY float64 `json:"offsetY"`
|
||||||
|
Rotation int `json:"rotation"`
|
||||||
|
AnchorX float64 `json:"anchorX"`
|
||||||
|
AnchorY float64 `json:"anchorY"`
|
||||||
|
Fit string `json:"fit"`
|
||||||
|
AlphaThreshold int `json:"alphaThreshold"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (n *NoteTexture) ToDB(dest *db.NoteTexture) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.Tint = n.Tint
|
||||||
|
dest.Src = n.Src
|
||||||
|
dest.ScaleX = n.ScaleX
|
||||||
|
dest.ScaleY = n.ScaleY
|
||||||
|
dest.OffsetX = n.OffsetX
|
||||||
|
dest.OffsetY = n.OffsetY
|
||||||
|
dest.Rotation = n.Rotation
|
||||||
|
dest.AnchorX = n.AnchorX
|
||||||
|
dest.AnchorY = n.AnchorY
|
||||||
|
dest.Fit = n.Fit
|
||||||
|
dest.AlphaThreshold = n.AlphaThreshold
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
76
internal/foundry/temp_models/json/options.go
Normal file
76
internal/foundry/temp_models/json/options.go
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
package json
|
||||||
|
|
||||||
|
import "gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/temp_models/db"
|
||||||
|
|
||||||
|
type GameOptions struct {
|
||||||
|
Language string `json:"language"`
|
||||||
|
Port int `json:"port"`
|
||||||
|
RoutePrefix any `json:"routePrefix"`
|
||||||
|
UpdateChannel string `json:"updateChannel"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GameOptions) ToDB(dest *db.GameOptions) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.Language = g.Language
|
||||||
|
dest.Port = g.Port
|
||||||
|
dest.UpdateChannel = g.UpdateChannel
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
type SetupOptions struct {
|
||||||
|
AwsConfig any `json:"awsConfig"`
|
||||||
|
CompressSocket bool `json:"compressSocket"`
|
||||||
|
CompressStatic bool `json:"compressStatic"`
|
||||||
|
CSSTheme string `json:"cssTheme"`
|
||||||
|
DataPath string `json:"dataPath"`
|
||||||
|
Fullscreen bool `json:"fullscreen"`
|
||||||
|
Hostname string `json:"hostname"`
|
||||||
|
HotReload bool `json:"hotReload"`
|
||||||
|
Language string `json:"language"`
|
||||||
|
LocalHostname string `json:"localHostname"`
|
||||||
|
// PasswordSalt any `json:"passwordSalt"`
|
||||||
|
Port int `json:"port"`
|
||||||
|
// Protocol any `json:"protocol"`
|
||||||
|
// ProxyPort any `json:"proxyPort"`
|
||||||
|
ProxySSL bool `json:"proxySSL"`
|
||||||
|
// RoutePrefix any `json:"routePrefix"`
|
||||||
|
// SslCert any `json:"sslCert"`
|
||||||
|
// SslKey any `json:"sslKey"`
|
||||||
|
Telemetry bool `json:"telemetry"`
|
||||||
|
UpdateChannel string `json:"updateChannel"`
|
||||||
|
Upnp bool `json:"upnp"`
|
||||||
|
// UpnpLeaseDuration any `json:"upnpLeaseDuration"`
|
||||||
|
// World any `json:"world"`
|
||||||
|
DeleteNEDB bool `json:"deleteNEDB"`
|
||||||
|
// AdminPassword string `json:"adminPassword"`
|
||||||
|
NoBackups bool `json:"noBackups"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *SetupOptions) ToDB(dest *db.SetupOptions) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.CompressSocket = s.CompressSocket
|
||||||
|
dest.CompressStatic = s.CompressStatic
|
||||||
|
dest.CSSTheme = s.CSSTheme
|
||||||
|
dest.DataPath = s.DataPath
|
||||||
|
dest.Fullscreen = s.Fullscreen
|
||||||
|
dest.Hostname = s.Hostname
|
||||||
|
dest.HotReload = s.HotReload
|
||||||
|
dest.Language = s.Language
|
||||||
|
dest.LocalHostname = s.LocalHostname
|
||||||
|
dest.Port = s.Port
|
||||||
|
dest.ProxySSL = s.ProxySSL
|
||||||
|
dest.Telemetry = s.Telemetry
|
||||||
|
dest.UpdateChannel = s.UpdateChannel
|
||||||
|
dest.Upnp = s.Upnp
|
||||||
|
dest.DeleteNEDB = s.DeleteNEDB
|
||||||
|
dest.NoBackups = s.NoBackups
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
15
internal/foundry/temp_models/json/ownership.go
Normal file
15
internal/foundry/temp_models/json/ownership.go
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
package json
|
||||||
|
|
||||||
|
import "gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/temp_models/db"
|
||||||
|
|
||||||
|
type Ownership struct {
|
||||||
|
Player string `json:"PLAYER,omitempty"`
|
||||||
|
Trusted string `json:"TRUSTED,omitempty"`
|
||||||
|
Assistant string `json:"ASSISTANT,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *Ownership) ToDB(dest *db.Ownership) {
|
||||||
|
dest.Player = o.Player
|
||||||
|
dest.Trusted = o.Trusted
|
||||||
|
dest.Assistant = o.Assistant
|
||||||
|
}
|
||||||
74
internal/foundry/temp_models/json/pack.go
Normal file
74
internal/foundry/temp_models/json/pack.go
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
package json
|
||||||
|
|
||||||
|
import (
|
||||||
|
"sync"
|
||||||
|
|
||||||
|
"gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/temp_models/db"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Pack struct {
|
||||||
|
Name string `json:"name"`
|
||||||
|
Label string `json:"label"`
|
||||||
|
Banner string `json:"banner"`
|
||||||
|
Path string `json:"path"`
|
||||||
|
Type string `json:"type"`
|
||||||
|
System string `json:"system"`
|
||||||
|
Ownership Ownership `json:"ownership"`
|
||||||
|
PackageType string `json:"packageType,omitempty"`
|
||||||
|
PackageName string `json:"packageName,omitempty"`
|
||||||
|
Id string `json:"id,omitempty"`
|
||||||
|
Index []*Index `json:"index"`
|
||||||
|
Folders []*PackFolder `json:"folders"`
|
||||||
|
// SystemPacksFlags SystemPacksFlags `json:"flags"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *Pack) ToDB(dest *db.Pack) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.Name = p.Name
|
||||||
|
dest.Label = p.Label
|
||||||
|
dest.Banner = p.Banner
|
||||||
|
dest.Path = p.Path
|
||||||
|
dest.Type = p.Type
|
||||||
|
dest.System = p.System
|
||||||
|
p.Ownership.ToDB(&dest.Ownership)
|
||||||
|
dest.PackageType = p.PackageType
|
||||||
|
dest.PackageName = p.PackageName
|
||||||
|
dest.ID = p.Id
|
||||||
|
|
||||||
|
wg := sync.WaitGroup{}
|
||||||
|
go CopySliceToDBParallel(&wg, &dest.Index, p.Index)
|
||||||
|
go CopySliceToDBParallel(&wg, &dest.Folders, p.Folders)
|
||||||
|
wg.Wait()
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
type PackFolder struct {
|
||||||
|
ID string `json:"_id"`
|
||||||
|
Color any `json:"color"`
|
||||||
|
Description string `json:"description"`
|
||||||
|
Folder any `json:"folder"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Sort int `json:"sort"`
|
||||||
|
Sorting string `json:"sorting"`
|
||||||
|
Type string `json:"type"`
|
||||||
|
// Packs0FoldersFlags any `json:"flags"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *PackFolder) ToDB(dest *db.PackFolder) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.ID = p.ID
|
||||||
|
dest.Description = p.Description
|
||||||
|
dest.Name = p.Name
|
||||||
|
dest.Sort = p.Sort
|
||||||
|
dest.Sorting = p.Sorting
|
||||||
|
dest.Type = p.Type
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
28
internal/foundry/temp_models/json/package_warnings.go
Normal file
28
internal/foundry/temp_models/json/package_warnings.go
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
package json
|
||||||
|
|
||||||
|
import "gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/temp_models/db"
|
||||||
|
|
||||||
|
type PackageWarningsData struct {
|
||||||
|
Id string `json:"id"`
|
||||||
|
Type string `json:"type"`
|
||||||
|
Warning []string `json:"warning"`
|
||||||
|
Error []string `json:"error"`
|
||||||
|
Reinstallable bool `json:"reinstallable"`
|
||||||
|
Manifest string `json:"manifest,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *PackageWarningsData) ToDB(dest *db.PackageWarningsData) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.ID = p.Id
|
||||||
|
dest.Type = p.Type
|
||||||
|
dest.Reinstallable = p.Reinstallable
|
||||||
|
dest.Manifest = p.Manifest
|
||||||
|
|
||||||
|
copy(dest.Warning, p.Warning)
|
||||||
|
copy(dest.Error, p.Error)
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
82
internal/foundry/temp_models/json/playlist.go
Normal file
82
internal/foundry/temp_models/json/playlist.go
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
package json
|
||||||
|
|
||||||
|
import "gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/temp_models/db"
|
||||||
|
|
||||||
|
type Playlist struct {
|
||||||
|
Name string `json:"name"`
|
||||||
|
ID string `json:"_id"`
|
||||||
|
Sounds []*Sound `json:"sounds"`
|
||||||
|
Mode int `json:"mode"`
|
||||||
|
Playing bool `json:"playing"`
|
||||||
|
Fade int `json:"fade,omitempty"`
|
||||||
|
Folder string `json:"folder"`
|
||||||
|
Sorting string `json:"sorting"`
|
||||||
|
Seed int `json:"seed,omitempty"`
|
||||||
|
Sort int `json:"sort"`
|
||||||
|
Ownership map[string]int `json:"ownership,omitempty"`
|
||||||
|
Stats Stats `json:"_stats"`
|
||||||
|
Description string `json:"description,omitempty"`
|
||||||
|
Channel string `json:"channel"`
|
||||||
|
// Flags any `json:"flags,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *Playlist) ToDB(dest *db.Playlist) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.Name = p.Name
|
||||||
|
dest.ID = p.ID
|
||||||
|
dest.Mode = p.Mode
|
||||||
|
dest.Playing = p.Playing
|
||||||
|
dest.Fade = p.Fade
|
||||||
|
dest.Folder = p.Folder
|
||||||
|
dest.Sorting = p.Sorting
|
||||||
|
dest.Seed = p.Seed
|
||||||
|
dest.Sort = p.Sort
|
||||||
|
dest.Description = p.Description
|
||||||
|
dest.Channel = p.Channel
|
||||||
|
|
||||||
|
p.Stats.ToDB(&dest.Stats)
|
||||||
|
|
||||||
|
OwnershipToDB(&dest.Ownership, p.Ownership)
|
||||||
|
|
||||||
|
CopySliceToDB(&dest.Sounds, p.Sounds)
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
type Sound struct {
|
||||||
|
Name string `json:"name"`
|
||||||
|
Path string `json:"path"`
|
||||||
|
ID string `json:"_id"`
|
||||||
|
Playing bool `json:"playing"`
|
||||||
|
PausedTime float64 `json:"pausedTime"`
|
||||||
|
Repeat bool `json:"repeat"`
|
||||||
|
Volume float64 `json:"volume"`
|
||||||
|
Fade int `json:"fade"`
|
||||||
|
Sort int `json:"sort"`
|
||||||
|
Channel string `json:"channel"`
|
||||||
|
Description string `json:"description,omitempty"`
|
||||||
|
// Flags any `json:"flags"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Sound) ToDB(dest *db.Sound) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.Name = s.Name
|
||||||
|
dest.Path = s.Path
|
||||||
|
dest.ID = s.ID
|
||||||
|
dest.Playing = s.Playing
|
||||||
|
dest.PausedTime = s.PausedTime
|
||||||
|
dest.Repeat = s.Repeat
|
||||||
|
dest.Volume = s.Volume
|
||||||
|
dest.Fade = s.Fade
|
||||||
|
dest.Sort = s.Sort
|
||||||
|
dest.Channel = s.Channel
|
||||||
|
dest.Description = s.Description
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
15
internal/foundry/temp_models/json/region_behavior.go
Normal file
15
internal/foundry/temp_models/json/region_behavior.go
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
package json
|
||||||
|
|
||||||
|
type RegionBehavior struct {
|
||||||
|
AdjustDarknessLevel any `json:"adjustDarknessLevel,omitempty"`
|
||||||
|
DisplayScrollingText any `json:"displayScrollingText,omitempty"`
|
||||||
|
ExecuteMacro any `json:"executeMacro,omitempty"`
|
||||||
|
ExecuteScript any `json:"executeScript,omitempty"`
|
||||||
|
ModifyMovementCost any `json:"modifyMovementCost,omitempty"`
|
||||||
|
PauseGame any `json:"pauseGame,omitempty"`
|
||||||
|
SuppressWeather any `json:"suppressWeather,omitempty"`
|
||||||
|
TeleportToken any `json:"teleportToken,omitempty"`
|
||||||
|
ToggleBehavior any `json:"toggleBehavior,omitempty"`
|
||||||
|
RegionBehaviorEnvironment any `json:"environment,omitempty"`
|
||||||
|
RegionBehaviorEnvironmentFeature any `json:"environmentFeature,omitempty"`
|
||||||
|
}
|
||||||
51
internal/foundry/temp_models/json/relationships.go
Normal file
51
internal/foundry/temp_models/json/relationships.go
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
package json
|
||||||
|
|
||||||
|
import (
|
||||||
|
"sync"
|
||||||
|
|
||||||
|
"gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/temp_models/db"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Relationships struct {
|
||||||
|
Systems []*RelationshipsData `json:"systems,omitempty"`
|
||||||
|
Requires []*RelationshipsData `json:"requires,omitempty"`
|
||||||
|
Recommends []*RelationshipsData `json:"recommends,omitempty"`
|
||||||
|
Conflicts []*RelationshipsData `json:"conflicts,omitempty"`
|
||||||
|
// RelationshipsFlags RelationshipsFlags `json:"flags"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *Relationships) ToDB(dest *db.Relationships) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
wg := sync.WaitGroup{}
|
||||||
|
go CopySliceToDBParallel(&wg, &dest.Systems, r.Systems)
|
||||||
|
go CopySliceToDBParallel(&wg, &dest.Requires, r.Requires)
|
||||||
|
go CopySliceToDBParallel(&wg, &dest.Recommends, r.Recommends)
|
||||||
|
go CopySliceToDBParallel(&wg, &dest.Conflicts, r.Conflicts)
|
||||||
|
wg.Wait()
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
type RelationshipsData struct {
|
||||||
|
Id string `json:"id"`
|
||||||
|
Type string `json:"type"`
|
||||||
|
Manifest string `json:"manifest"`
|
||||||
|
Compatibility Compatibility `json:"compatibility"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *RelationshipsData) ToDB(dest *db.RelationshipsData) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.ID = r.Id
|
||||||
|
dest.Type = r.Type
|
||||||
|
dest.Manifest = r.Manifest
|
||||||
|
|
||||||
|
r.Compatibility.ToDB(&dest.Compatibility)
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
32
internal/foundry/temp_models/json/release.go
Normal file
32
internal/foundry/temp_models/json/release.go
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
package json
|
||||||
|
|
||||||
|
import "gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/temp_models/db"
|
||||||
|
|
||||||
|
type Release struct {
|
||||||
|
Generation int `json:"generation"`
|
||||||
|
Channel string `json:"channel"`
|
||||||
|
Suffix string `json:"suffix"`
|
||||||
|
Build int `json:"build"`
|
||||||
|
NodeVersion int `json:"node_version"`
|
||||||
|
MaxGeneration int `json:"maxGeneration"`
|
||||||
|
MaxStableGeneration int `json:"maxStableGeneration"`
|
||||||
|
Time int64 `json:"time"`
|
||||||
|
// Flags Flags `json:"flags"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *Release) ToDB(dest *db.Release) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.Generation = r.Generation
|
||||||
|
dest.Channel = r.Channel
|
||||||
|
dest.Suffix = r.Suffix
|
||||||
|
dest.Build = r.Build
|
||||||
|
dest.NodeVersion = r.NodeVersion
|
||||||
|
dest.MaxGeneration = r.MaxGeneration
|
||||||
|
dest.MaxStableGeneration = r.MaxStableGeneration
|
||||||
|
dest.Time = r.Time
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
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
|
||||||
|
}
|
||||||
414
internal/foundry/temp_models/json/scene.go
Normal file
414
internal/foundry/temp_models/json/scene.go
Normal file
@@ -0,0 +1,414 @@
|
|||||||
|
package json
|
||||||
|
|
||||||
|
import (
|
||||||
|
"sync"
|
||||||
|
|
||||||
|
"gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/temp_models/db"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Scene struct {
|
||||||
|
Folder string `json:"folder"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Active bool `json:"active"`
|
||||||
|
Navigation bool `json:"navigation"`
|
||||||
|
NavOrder int `json:"navOrder"`
|
||||||
|
NavName string `json:"navName"`
|
||||||
|
Background SceneBackground `json:"background"`
|
||||||
|
Foreground string `json:"foreground"`
|
||||||
|
ForegroundElevation int `json:"foregroundElevation"`
|
||||||
|
Thumb string `json:"thumb"`
|
||||||
|
Width int `json:"width"`
|
||||||
|
Height int `json:"height"`
|
||||||
|
Padding float64 `json:"padding"`
|
||||||
|
Initial SceneInitial `json:"initial"`
|
||||||
|
BackgroundColor string `json:"backgroundColor"`
|
||||||
|
Grid SceneGrid `json:"grid"`
|
||||||
|
TokenVision bool `json:"tokenVision"`
|
||||||
|
Drawings []*SceneDrawing `json:"drawings"`
|
||||||
|
Tokens []*Token `json:"tokens"`
|
||||||
|
Lights []*SceneLight `json:"lights"`
|
||||||
|
Notes []*Note `json:"notes"`
|
||||||
|
Sounds []*ScenesSound `json:"sounds"`
|
||||||
|
Walls []*Wall `json:"walls"`
|
||||||
|
Playlist string `json:"playlist"`
|
||||||
|
PlaylistSound string `json:"playlistSound"`
|
||||||
|
Journal string `json:"journal"`
|
||||||
|
JournalEntryPage string `json:"journalEntryPage"`
|
||||||
|
Weather string `json:"weather"`
|
||||||
|
Sort int `json:"sort"`
|
||||||
|
Ownership map[string]int `json:"ownership,omitempty"`
|
||||||
|
Stats Stats `json:"_stats"`
|
||||||
|
ID string `json:"_id"`
|
||||||
|
Fog SceneFog `json:"fog,omitempty"`
|
||||||
|
Environment Environment `json:"environment"`
|
||||||
|
|
||||||
|
// ScenesTemplates []any `json:"templates"`
|
||||||
|
// Tiles []any `json:"tiles"`
|
||||||
|
// ScenesFlags any `json:"flags,omitempty"`
|
||||||
|
// Regions []any `json:"regions"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Scene) ToDB(dest *db.Scene) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.Folder = s.Folder
|
||||||
|
dest.Name = s.Name
|
||||||
|
dest.Active = s.Active
|
||||||
|
dest.Navigation = s.Navigation
|
||||||
|
dest.NavOrder = s.NavOrder
|
||||||
|
dest.NavName = s.NavName
|
||||||
|
dest.Foreground = s.Foreground
|
||||||
|
dest.ForegroundElevation = s.ForegroundElevation
|
||||||
|
dest.Thumb = s.Thumb
|
||||||
|
dest.Width = s.Width
|
||||||
|
dest.Height = s.Height
|
||||||
|
dest.Padding = s.Padding
|
||||||
|
dest.BackgroundColor = s.BackgroundColor
|
||||||
|
dest.TokenVision = s.TokenVision
|
||||||
|
dest.Playlist = s.Playlist
|
||||||
|
dest.PlaylistSound = s.PlaylistSound
|
||||||
|
dest.Journal = s.Journal
|
||||||
|
dest.JournalEntryPage = s.JournalEntryPage
|
||||||
|
dest.Weather = s.Weather
|
||||||
|
dest.Sort = s.Sort
|
||||||
|
dest.ID = s.ID
|
||||||
|
|
||||||
|
s.Background.ToDB(&dest.Background)
|
||||||
|
s.Initial.ToDB(&dest.Initial)
|
||||||
|
s.Grid.ToDB(&dest.Grid)
|
||||||
|
s.Stats.ToDB(&dest.Stats)
|
||||||
|
s.Fog.ToDB(&dest.Fog)
|
||||||
|
s.Environment.ToDB(&dest.Environment)
|
||||||
|
|
||||||
|
OwnershipToDB(&dest.Ownership, s.Ownership)
|
||||||
|
|
||||||
|
wg := sync.WaitGroup{}
|
||||||
|
go CopySliceToDBParallel(&wg, &dest.Drawings, s.Drawings)
|
||||||
|
go CopySliceToDBParallel(&wg, &dest.Tokens, s.Tokens)
|
||||||
|
go CopySliceToDBParallel(&wg, &dest.Lights, s.Lights)
|
||||||
|
go CopySliceToDBParallel(&wg, &dest.Notes, s.Notes)
|
||||||
|
go CopySliceToDBParallel(&wg, &dest.Sounds, s.Sounds)
|
||||||
|
go CopySliceToDBParallel(&wg, &dest.Walls, s.Walls)
|
||||||
|
wg.Wait()
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
type SceneBackground struct {
|
||||||
|
Src string `json:"src"`
|
||||||
|
ScaleX float64 `json:"scaleX"`
|
||||||
|
ScaleY float64 `json:"scaleY"`
|
||||||
|
OffsetX float64 `json:"offsetX"`
|
||||||
|
OffsetY float64 `json:"offsetY"`
|
||||||
|
Rotation int `json:"rotation"`
|
||||||
|
Tint string `json:"tint"`
|
||||||
|
AnchorX float64 `json:"anchorX"`
|
||||||
|
AnchorY float64 `json:"anchorY"`
|
||||||
|
Fit string `json:"fit"`
|
||||||
|
AlphaThreshold int `json:"alphaThreshold"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *SceneBackground) ToDB(dest *db.SceneBackground) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.Src = s.Src
|
||||||
|
dest.ScaleX = s.ScaleX
|
||||||
|
dest.ScaleY = s.ScaleY
|
||||||
|
dest.OffsetX = s.OffsetX
|
||||||
|
dest.OffsetY = s.OffsetY
|
||||||
|
dest.Rotation = s.Rotation
|
||||||
|
dest.Tint = s.Tint
|
||||||
|
dest.AnchorX = s.AnchorX
|
||||||
|
dest.AnchorX = s.AnchorY
|
||||||
|
dest.Fit = s.Fit
|
||||||
|
dest.AlphaThreshold = s.AlphaThreshold
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
type SceneInitial struct {
|
||||||
|
X float64 `json:"x"`
|
||||||
|
Y float64 `json:"y"`
|
||||||
|
Scale float64 `json:"scale"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *SceneInitial) ToDB(dest *db.SceneInitial) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.X = s.X
|
||||||
|
dest.Y = s.Y
|
||||||
|
dest.Scale = s.Scale
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
type SceneGrid struct {
|
||||||
|
Type int `json:"type"`
|
||||||
|
Size int `json:"size"`
|
||||||
|
Color string `json:"color"`
|
||||||
|
Alpha float64 `json:"alpha"`
|
||||||
|
Distance int `json:"distance"`
|
||||||
|
Units string `json:"units"`
|
||||||
|
Style string `json:"style"`
|
||||||
|
Thickness int `json:"thickness"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *SceneGrid) ToDB(dest *db.SceneGrid) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.Type = s.Type
|
||||||
|
dest.Size = s.Size
|
||||||
|
dest.Color = s.Color
|
||||||
|
dest.Alpha = s.Alpha
|
||||||
|
dest.Distance = s.Distance
|
||||||
|
dest.Units = s.Units
|
||||||
|
dest.Style = s.Style
|
||||||
|
dest.Thickness = s.Thickness
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
type SceneDrawing struct {
|
||||||
|
Author string `json:"author"`
|
||||||
|
Shape SceneDrawingShape `json:"shape"`
|
||||||
|
X float64 `json:"x"`
|
||||||
|
Y float64 `json:"y"`
|
||||||
|
Rotation int `json:"rotation"`
|
||||||
|
BezierFactor int `json:"bezierFactor"`
|
||||||
|
FillType int `json:"fillType"`
|
||||||
|
FillColor string `json:"fillColor"`
|
||||||
|
FillAlpha float64 `json:"fillAlpha"`
|
||||||
|
StrokeWidth int `json:"strokeWidth"`
|
||||||
|
StrokeColor string `json:"strokeColor"`
|
||||||
|
StrokeAlpha int `json:"strokeAlpha"`
|
||||||
|
Texture string `json:"texture"`
|
||||||
|
Text string `json:"text"`
|
||||||
|
FontFamily string `json:"fontFamily"`
|
||||||
|
FontSize int `json:"fontSize"`
|
||||||
|
TextColor string `json:"textColor"`
|
||||||
|
TextAlpha int `json:"textAlpha"`
|
||||||
|
Hidden bool `json:"hidden"`
|
||||||
|
Locked bool `json:"locked"`
|
||||||
|
ID string `json:"_id"`
|
||||||
|
Interface bool `json:"interface"`
|
||||||
|
Elevation int `json:"elevation"`
|
||||||
|
Sort int `json:"sort"`
|
||||||
|
// Flags any `json:"flags"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *SceneDrawing) ToDB(dest *db.SceneDrawing) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.Author = s.Author
|
||||||
|
dest.X = s.X
|
||||||
|
dest.Y = s.Y
|
||||||
|
dest.Rotation = s.Rotation
|
||||||
|
dest.BezierFactor = s.BezierFactor
|
||||||
|
dest.FillType = s.FillType
|
||||||
|
dest.FillColor = s.FillColor
|
||||||
|
dest.FillAlpha = s.FillAlpha
|
||||||
|
dest.StrokeWidth = s.StrokeWidth
|
||||||
|
dest.StrokeColor = s.StrokeColor
|
||||||
|
dest.StrokeAlpha = s.StrokeAlpha
|
||||||
|
dest.Texture = s.Texture
|
||||||
|
dest.Text = s.Text
|
||||||
|
dest.FontFamily = s.FontFamily
|
||||||
|
dest.FontSize = s.FontSize
|
||||||
|
dest.TextColor = s.TextColor
|
||||||
|
dest.TextAlpha = s.TextAlpha
|
||||||
|
dest.Hidden = s.Hidden
|
||||||
|
dest.Locked = s.Locked
|
||||||
|
dest.ID = s.ID
|
||||||
|
dest.Interface = s.Interface
|
||||||
|
dest.Elevation = s.Elevation
|
||||||
|
dest.Sort = s.Sort
|
||||||
|
|
||||||
|
s.Shape.ToDB(&dest.Shape)
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
type SceneDrawingShape struct {
|
||||||
|
Type string `json:"type"`
|
||||||
|
Width int `json:"width"`
|
||||||
|
Height int `json:"height"`
|
||||||
|
Radius any `json:"radius"`
|
||||||
|
Points []any `json:"points"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *SceneDrawingShape) ToDB(dest *db.SceneDrawingShape) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.Type = s.Type
|
||||||
|
dest.Width = s.Width
|
||||||
|
dest.Height = s.Height
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
type SceneLight struct {
|
||||||
|
X float64 `json:"x"`
|
||||||
|
Y float64 `json:"y"`
|
||||||
|
Rotation int `json:"rotation"`
|
||||||
|
Walls bool `json:"walls"`
|
||||||
|
Vision bool `json:"vision"`
|
||||||
|
Config Light `json:"config"`
|
||||||
|
Hidden bool `json:"hidden"`
|
||||||
|
Flags any `json:"flags"`
|
||||||
|
Id string `json:"_id"`
|
||||||
|
Elevation int `json:"elevation"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *SceneLight) ToDB(dest *db.SceneLight) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.X = s.X
|
||||||
|
dest.Y = s.Y
|
||||||
|
dest.Rotation = s.Rotation
|
||||||
|
dest.Walls = s.Walls
|
||||||
|
dest.Vision = s.Vision
|
||||||
|
dest.Hidden = s.Hidden
|
||||||
|
dest.ID = s.Id
|
||||||
|
dest.Elevation = s.Elevation
|
||||||
|
|
||||||
|
s.Config.ToDB(&dest.Config)
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
type ScenesSound struct {
|
||||||
|
Path string `json:"path"`
|
||||||
|
X float64 `json:"x"`
|
||||||
|
Y float64 `json:"y"`
|
||||||
|
Radius float64 `json:"radius"`
|
||||||
|
Easing bool `json:"easing"`
|
||||||
|
Walls bool `json:"walls"`
|
||||||
|
Volume float64 `json:"volume"`
|
||||||
|
Darkness ScenesSoundsDarkness `json:"darkness"`
|
||||||
|
ID string `json:"_id"`
|
||||||
|
Repeat bool `json:"repeat"`
|
||||||
|
Hidden bool `json:"hidden"`
|
||||||
|
Elevation float64 `json:"elevation"`
|
||||||
|
Effects ScenesSoundsEffects `json:"effects"`
|
||||||
|
// Flags any `json:"flags"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *ScenesSound) ToDB(dest *db.ScenesSound) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.Path = s.Path
|
||||||
|
dest.X = s.X
|
||||||
|
dest.Y = s.Y
|
||||||
|
dest.Radius = s.Radius
|
||||||
|
dest.Easing = s.Easing
|
||||||
|
dest.Walls = s.Walls
|
||||||
|
dest.Volume = s.Volume
|
||||||
|
dest.ID = s.ID
|
||||||
|
dest.Repeat = s.Repeat
|
||||||
|
dest.Hidden = s.Hidden
|
||||||
|
dest.Elevation = s.Elevation
|
||||||
|
|
||||||
|
s.Darkness.ToDB(&dest.Darkness)
|
||||||
|
s.Effects.ToDB(&dest.Effects)
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
type ScenesSoundsDarkness struct {
|
||||||
|
Min int `json:"min"`
|
||||||
|
Max int `json:"max"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *ScenesSoundsDarkness) ToDB(dest *db.ScenesSoundsDarkness) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.Min = s.Min
|
||||||
|
dest.Max = s.Max
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
type ScenesSoundsEffects struct {
|
||||||
|
Base ScenesSoundsEffectsBase `json:"base"`
|
||||||
|
Muffled ScenesSoundsEffectsBase `json:"muffled"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *ScenesSoundsEffects) ToDB(dest *db.ScenesSoundsEffects) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
s.Base.ToDB(&dest.Base)
|
||||||
|
s.Muffled.ToDB(&dest.Muffled)
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
type ScenesSoundsEffectsBase struct {
|
||||||
|
Intensity int `json:"intensity"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *ScenesSoundsEffectsBase) ToDB(dest *db.ScenesSoundsEffectsBase) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.Intensity = s.Intensity
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
type SceneFog struct {
|
||||||
|
Exploration bool `json:"exploration"`
|
||||||
|
Reset int64 `json:"reset"`
|
||||||
|
Overlay string `json:"overlay"`
|
||||||
|
Colors SceneFogColors `json:"colors"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *SceneFog) ToDB(dest *db.SceneFog) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.Exploration = s.Exploration
|
||||||
|
dest.Reset = s.Reset
|
||||||
|
dest.Overlay = s.Overlay
|
||||||
|
|
||||||
|
s.Colors.ToDB(&dest.Colors)
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
type SceneFogColors struct {
|
||||||
|
Explored string `json:"explored"`
|
||||||
|
Unexplored string `json:"unexplored"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *SceneFogColors) ToDB(dest *db.SceneFogColors) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.Explored = s.Explored
|
||||||
|
dest.Unexplored = s.Unexplored
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
24
internal/foundry/temp_models/json/settings.go
Normal file
24
internal/foundry/temp_models/json/settings.go
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
package json
|
||||||
|
|
||||||
|
import "gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/temp_models/db"
|
||||||
|
|
||||||
|
type Setting struct {
|
||||||
|
Key string `json:"key"`
|
||||||
|
User any `json:"user"`
|
||||||
|
Value string `json:"value"`
|
||||||
|
ID string `json:"_id"`
|
||||||
|
Stats Stats `json:"_stats"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Setting) ToDB(dest *db.Setting) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.Key = s.Key
|
||||||
|
dest.Value = s.Value
|
||||||
|
dest.ID = s.ID
|
||||||
|
s.Stats.ToDB(&dest.Stats)
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
90
internal/foundry/temp_models/json/setup.go
Normal file
90
internal/foundry/temp_models/json/setup.go
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
package json
|
||||||
|
|
||||||
|
import (
|
||||||
|
"sync"
|
||||||
|
|
||||||
|
"gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/temp_models/db"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Setup struct {
|
||||||
|
CoreUpdate CoreUpdate `json:"coreUpdate"`
|
||||||
|
FeaturedContent FeaturedContent `json:"featuredContent"`
|
||||||
|
Files Files `json:"files"`
|
||||||
|
IsAdmin bool `json:"isAdmin"`
|
||||||
|
IsSetup bool `json:"isSetup"`
|
||||||
|
Languages []*SetupLanguage `json:"languages"`
|
||||||
|
Modules []*Module `json:"modules"`
|
||||||
|
News []*News `json:"news"`
|
||||||
|
Options SetupOptions `json:"options"`
|
||||||
|
PackageWarnings map[string]PackageWarningsData `json:"packageWarnings"`
|
||||||
|
Release Release `json:"release"`
|
||||||
|
Systems []*System `json:"systems"`
|
||||||
|
Worlds []*World `json:"worlds"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Setup) ToDB(dest *db.Setup) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.IsAdmin = s.IsAdmin
|
||||||
|
dest.IsSetup = s.IsSetup
|
||||||
|
|
||||||
|
s.CoreUpdate.ToDB(&dest.CoreUpdate)
|
||||||
|
s.FeaturedContent.ToDB(&dest.FeaturedContent)
|
||||||
|
s.Files.ToDB(&dest.Files)
|
||||||
|
s.Options.ToDB(&dest.Options)
|
||||||
|
s.Release.ToDB(&dest.Release)
|
||||||
|
|
||||||
|
PackageWarningsToDB(&dest.PackageWarnings, s.PackageWarnings)
|
||||||
|
|
||||||
|
wg := sync.WaitGroup{}
|
||||||
|
go CopySliceToDBParallel(&wg, &dest.Languages, s.Languages)
|
||||||
|
go CopySliceToDBParallel(&wg, &dest.Modules, s.Modules)
|
||||||
|
go CopySliceToDBParallel(&wg, &dest.News, s.News)
|
||||||
|
go CopySliceToDBParallel(&wg, &dest.Systems, s.Systems)
|
||||||
|
go CopySliceToDBParallel(&wg, &dest.Worlds, s.Worlds)
|
||||||
|
wg.Wait()
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
type FeaturedContent struct {
|
||||||
|
Title string `json:"title"`
|
||||||
|
Caption string `json:"caption"`
|
||||||
|
URL string `json:"url"`
|
||||||
|
Image string `json:"image"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *FeaturedContent) ToDB(dest *db.FeaturedContent) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.Title = f.Title
|
||||||
|
dest.Caption = f.Caption
|
||||||
|
dest.URL = f.URL
|
||||||
|
dest.Image = f.Image
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
type News struct {
|
||||||
|
Title string `json:"title"`
|
||||||
|
Caption string `json:"caption"`
|
||||||
|
URL string `json:"url"`
|
||||||
|
Image string `json:"image"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (n *News) ToDB(dest *db.News) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.Title = n.Title
|
||||||
|
dest.Caption = n.Caption
|
||||||
|
dest.URL = n.Caption
|
||||||
|
dest.Image = n.Image
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
28
internal/foundry/temp_models/json/stats.go
Normal file
28
internal/foundry/temp_models/json/stats.go
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
package json
|
||||||
|
|
||||||
|
import "gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/temp_models/db"
|
||||||
|
|
||||||
|
type Stats struct {
|
||||||
|
CoreVersion string `json:"coreVersion"`
|
||||||
|
SystemID string `json:"systemId"`
|
||||||
|
SystemVersion string `json:"systemVersion"`
|
||||||
|
LastModifiedBy string `json:"lastModifiedBy"`
|
||||||
|
ModifiedTime int64 `json:"modifiedTime"`
|
||||||
|
// CompendiumSource string `json:"compendiumSource,omitempty"`
|
||||||
|
// DuplicateSource string `json:"duplicateSource,omitempty"`
|
||||||
|
// ExportSource string `json:"exportSource,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Stats) ToDB(dest *db.Stats) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.CoreVersion = s.CoreVersion
|
||||||
|
dest.SystemID = s.SystemID
|
||||||
|
dest.SystemVersion = s.SystemVersion
|
||||||
|
dest.LastModifiedBy = s.LastModifiedBy
|
||||||
|
dest.ModifiedTime = s.ModifiedTime
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
17
internal/foundry/temp_models/json/style.go
Normal file
17
internal/foundry/temp_models/json/style.go
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
package json
|
||||||
|
|
||||||
|
import "gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/temp_models/db"
|
||||||
|
|
||||||
|
type Style struct {
|
||||||
|
Src string `json:"src"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Style) ToDB(dest *db.Style) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.Src = s.Src
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
91
internal/foundry/temp_models/json/system.go
Normal file
91
internal/foundry/temp_models/json/system.go
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
package json
|
||||||
|
|
||||||
|
import (
|
||||||
|
"sync"
|
||||||
|
|
||||||
|
"gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/temp_models/db"
|
||||||
|
)
|
||||||
|
|
||||||
|
type System struct {
|
||||||
|
ID string `json:"id"`
|
||||||
|
Title string `json:"title"`
|
||||||
|
Description string `json:"description"`
|
||||||
|
Authors []*Author `json:"authors"`
|
||||||
|
URL string `json:"url"`
|
||||||
|
License string `json:"license"`
|
||||||
|
Bugs string `json:"bugs"`
|
||||||
|
Changelog string `json:"changelog"`
|
||||||
|
Media []*Media `json:"media"`
|
||||||
|
Version string `json:"version"`
|
||||||
|
Compatibility Compatibility `json:"compatibility"`
|
||||||
|
Scripts []string `json:"scripts"`
|
||||||
|
Esmodules []string `json:"esmodules"`
|
||||||
|
Packs []*Pack `json:"packs"`
|
||||||
|
Styles []*Style `json:"styles"`
|
||||||
|
Languages []*Language `json:"languages"`
|
||||||
|
PackFolders []*Folder `json:"packFolders"`
|
||||||
|
Relationships Relationships `json:"relationships"`
|
||||||
|
Socket bool `json:"socket"`
|
||||||
|
Manifest string `json:"manifest"`
|
||||||
|
Download string `json:"download"`
|
||||||
|
Protected bool `json:"protected"`
|
||||||
|
Exclusive bool `json:"exclusive"`
|
||||||
|
PersistentStorage bool `json:"persistentStorage"`
|
||||||
|
DocumentTypes DocumentTypes `json:"documentTypes"`
|
||||||
|
Background string `json:"background"`
|
||||||
|
Grid Grid `json:"grid"`
|
||||||
|
PrimaryTokenAttribute string `json:"primaryTokenAttribute"`
|
||||||
|
Availability int `json:"availability"`
|
||||||
|
Locked bool `json:"locked"`
|
||||||
|
Owned bool `json:"owned"`
|
||||||
|
Tags []string `json:"tags"`
|
||||||
|
HasStorage bool `json:"hasStorage"`
|
||||||
|
// SystemFlags SystemFlags `json:"flags"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *System) ToDB(dest *db.System) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.ID = s.ID
|
||||||
|
dest.Title = s.Title
|
||||||
|
dest.Description = s.Description
|
||||||
|
dest.URL = s.URL
|
||||||
|
dest.License = s.License
|
||||||
|
dest.Bugs = s.Bugs
|
||||||
|
dest.Changelog = s.Changelog
|
||||||
|
dest.Version = s.Version
|
||||||
|
dest.Socket = s.Socket
|
||||||
|
dest.Manifest = s.Manifest
|
||||||
|
dest.Download = s.Download
|
||||||
|
dest.Protected = s.Protected
|
||||||
|
dest.Exclusive = s.Exclusive
|
||||||
|
dest.PersistentStorage = s.PersistentStorage
|
||||||
|
dest.Background = s.Background
|
||||||
|
dest.PrimaryTokenAttribute = s.PrimaryTokenAttribute
|
||||||
|
dest.Availability = s.Availability
|
||||||
|
dest.Locked = s.Locked
|
||||||
|
dest.Owned = s.Owned
|
||||||
|
dest.HasStorage = s.HasStorage
|
||||||
|
|
||||||
|
copy(dest.Scripts, s.Scripts)
|
||||||
|
copy(dest.Esmodules, s.Esmodules)
|
||||||
|
copy(dest.Tags, s.Tags)
|
||||||
|
|
||||||
|
s.Compatibility.ToDB(&dest.Compatibility)
|
||||||
|
s.Relationships.ToDB(&dest.Relationships)
|
||||||
|
s.DocumentTypes.ToDB(&dest.DocumentTypes)
|
||||||
|
s.Grid.ToDB(&dest.Grid)
|
||||||
|
|
||||||
|
wg := sync.WaitGroup{}
|
||||||
|
go CopySliceToDBParallel(&wg, &dest.Authors, s.Authors)
|
||||||
|
go CopySliceToDBParallel(&wg, &dest.Media, s.Media)
|
||||||
|
go CopySliceToDBParallel(&wg, &dest.Styles, s.Styles)
|
||||||
|
go CopySliceToDBParallel(&wg, &dest.Languages, s.Languages)
|
||||||
|
go CopySliceToDBParallel(&wg, &dest.Packs, s.Packs)
|
||||||
|
go CopySliceToDBParallel(&wg, &dest.PackFolders, s.PackFolders)
|
||||||
|
wg.Wait()
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
76
internal/foundry/temp_models/json/table.go
Normal file
76
internal/foundry/temp_models/json/table.go
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
package json
|
||||||
|
|
||||||
|
import "gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/temp_models/db"
|
||||||
|
|
||||||
|
type Table struct {
|
||||||
|
Name string `json:"name"`
|
||||||
|
Results []*TableResult `json:"results"`
|
||||||
|
Description string `json:"description"`
|
||||||
|
Formula string `json:"formula"`
|
||||||
|
ID string `json:"_id"`
|
||||||
|
Img string `json:"img"`
|
||||||
|
Replacement bool `json:"replacement"`
|
||||||
|
DisplayRoll bool `json:"displayRoll"`
|
||||||
|
Folder string `json:"folder"`
|
||||||
|
Sort int `json:"sort"`
|
||||||
|
Ownership map[string]int `json:"ownership,omitempty"`
|
||||||
|
Stats Stats `json:"_stats"`
|
||||||
|
// TablesFlags any `json:"flags,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t *Table) ToDB(dest *db.Table) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.Name = t.Name
|
||||||
|
dest.Description = t.Description
|
||||||
|
dest.Formula = t.Formula
|
||||||
|
dest.ID = t.ID
|
||||||
|
dest.Img = t.Img
|
||||||
|
dest.Replacement = t.Replacement
|
||||||
|
dest.DisplayRoll = t.DisplayRoll
|
||||||
|
dest.Folder = t.Folder
|
||||||
|
dest.Sort = t.Sort
|
||||||
|
|
||||||
|
t.Stats.ToDB(&dest.Stats)
|
||||||
|
|
||||||
|
OwnershipToDB(&dest.Ownership, t.Ownership)
|
||||||
|
|
||||||
|
CopySliceToDB(&dest.Results, t.Results)
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
type TableResult struct {
|
||||||
|
Type string `json:"type"`
|
||||||
|
Weight int `json:"weight"`
|
||||||
|
Range []int `json:"range"`
|
||||||
|
Drawn bool `json:"drawn"`
|
||||||
|
ID string `json:"_id"`
|
||||||
|
Img string `json:"img"`
|
||||||
|
Stats Stats `json:"_stats"`
|
||||||
|
Description string `json:"description"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
// ResultsFlags any `json:"flags"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t *TableResult) ToDB(dest *db.TableResult) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.Type = t.Type
|
||||||
|
dest.Weight = t.Weight
|
||||||
|
dest.Drawn = t.Drawn
|
||||||
|
dest.ID = t.ID
|
||||||
|
dest.Img = t.Img
|
||||||
|
dest.Description = t.Description
|
||||||
|
dest.Name = t.Name
|
||||||
|
|
||||||
|
copy(dest.Range, t.Range)
|
||||||
|
|
||||||
|
t.Stats.ToDB(&dest.Stats)
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
169
internal/foundry/temp_models/json/token.go
Normal file
169
internal/foundry/temp_models/json/token.go
Normal 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
|
||||||
|
}
|
||||||
45
internal/foundry/temp_models/json/update.go
Normal file
45
internal/foundry/temp_models/json/update.go
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
package json
|
||||||
|
|
||||||
|
import "gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/temp_models/db"
|
||||||
|
|
||||||
|
type CoreUpdate struct {
|
||||||
|
HasUpdate bool `json:"hasUpdate"`
|
||||||
|
CanUpdate bool `json:"canUpdate"`
|
||||||
|
CouldReachWebsite bool `json:"couldReachWebsite"`
|
||||||
|
SlowResponse bool `json:"slowResponse"`
|
||||||
|
Version string `json:"version"`
|
||||||
|
Channel string `json:"channel"`
|
||||||
|
WillDisableModules bool `json:"willDisableModules"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *CoreUpdate) ToDB(dest *db.CoreUpdate) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.HasUpdate = c.HasUpdate
|
||||||
|
dest.CanUpdate = c.CanUpdate
|
||||||
|
dest.CouldReachWebsite = c.CouldReachWebsite
|
||||||
|
dest.SlowResponse = c.SlowResponse
|
||||||
|
dest.Version = c.Version
|
||||||
|
dest.Channel = c.Channel
|
||||||
|
dest.WillDisableModules = c.WillDisableModules
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
type SystemUpdate struct {
|
||||||
|
HasUpdate bool `json:"hasUpdate"`
|
||||||
|
Version string `json:"version"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *SystemUpdate) ToDB(dest *db.SystemUpdate) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.HasUpdate = s.HasUpdate
|
||||||
|
dest.Version = s.Version
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
37
internal/foundry/temp_models/json/user.go
Normal file
37
internal/foundry/temp_models/json/user.go
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
package json
|
||||||
|
|
||||||
|
import "gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/temp_models/db"
|
||||||
|
|
||||||
|
type User struct {
|
||||||
|
Name string `json:"name"`
|
||||||
|
Role int `json:"role"`
|
||||||
|
ID string `json:"_id"`
|
||||||
|
Avatar string `json:"avatar"`
|
||||||
|
Character string `json:"character"`
|
||||||
|
Color string `json:"color"`
|
||||||
|
Pronouns string `json:"pronouns"`
|
||||||
|
Hotbar map[int]string `json:"hotbar,omitempty"`
|
||||||
|
UsersStats Stats `json:"_stats"`
|
||||||
|
// Permissions any `json:"permissions"`
|
||||||
|
// UsersFlags any `json:"flags,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (u *User) ToDB(dest *db.User) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.Name = u.Name
|
||||||
|
dest.Role = u.Role
|
||||||
|
dest.ID = u.ID
|
||||||
|
dest.Avatar = u.Avatar
|
||||||
|
dest.Character = u.Character
|
||||||
|
dest.Color = u.Color
|
||||||
|
dest.Pronouns = u.Pronouns
|
||||||
|
|
||||||
|
u.UsersStats.ToDB(&dest.Stats)
|
||||||
|
|
||||||
|
HotbarToDB(&dest.Hotbar, u.Hotbar)
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
63
internal/foundry/temp_models/json/utils.go
Normal file
63
internal/foundry/temp_models/json/utils.go
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
package json
|
||||||
|
|
||||||
|
import (
|
||||||
|
"sync"
|
||||||
|
|
||||||
|
"gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/temp_models/db"
|
||||||
|
)
|
||||||
|
|
||||||
|
func OwnershipToDB(dest *[]db.OwnershipString, src map[string]int) {
|
||||||
|
*dest = make([]db.OwnershipString, len(src))
|
||||||
|
|
||||||
|
i := 0
|
||||||
|
for k, v := range src {
|
||||||
|
(*dest)[i].Key = k
|
||||||
|
(*dest)[i].Value = v
|
||||||
|
i++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func HotbarToDB(dest *[]db.UserHotbar, src map[int]string) {
|
||||||
|
*dest = make([]db.UserHotbar, len(src))
|
||||||
|
|
||||||
|
i := 0
|
||||||
|
for k, v := range src {
|
||||||
|
(*dest)[i].Key = k
|
||||||
|
(*dest)[i].Value = v
|
||||||
|
i++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func PackageWarningsToDB(dest *[]db.PackageWarning, src map[string]PackageWarningsData) {
|
||||||
|
*dest = make([]db.PackageWarning, len(src))
|
||||||
|
|
||||||
|
i := 0
|
||||||
|
for k, v := range src {
|
||||||
|
(*dest)[i].Key = k
|
||||||
|
v.ToDB(&(*dest)[i].Value)
|
||||||
|
i++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type CastableToDB[destType any] interface {
|
||||||
|
ToDB(*destType) bool
|
||||||
|
}
|
||||||
|
|
||||||
|
func CopySliceToDB[destType any, srcType CastableToDB[destType]](dest *[]destType, src []srcType) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
*dest = make([]destType, len(src))
|
||||||
|
for i := range src {
|
||||||
|
src[i].ToDB(&(*dest)[i])
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func CopySliceToDBParallel[destType any, srcType CastableToDB[destType]](wg *sync.WaitGroup, dest *[]destType, src []srcType) {
|
||||||
|
wg.Add(1)
|
||||||
|
CopySliceToDB(dest, src)
|
||||||
|
wg.Done()
|
||||||
|
}
|
||||||
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
|
||||||
|
}
|
||||||
93
internal/foundry/temp_models/json/world.go
Normal file
93
internal/foundry/temp_models/json/world.go
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
package json
|
||||||
|
|
||||||
|
import (
|
||||||
|
"sync"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/temp_models/db"
|
||||||
|
)
|
||||||
|
|
||||||
|
type World struct {
|
||||||
|
ID string `json:"id"`
|
||||||
|
Title string `json:"title"`
|
||||||
|
Description string `json:"description"`
|
||||||
|
Authors []*Author `json:"authors"`
|
||||||
|
Media []*Media `json:"media"`
|
||||||
|
Version string `json:"version"`
|
||||||
|
Compatibility Compatibility `json:"compatibility"`
|
||||||
|
Scripts []string `json:"scripts"`
|
||||||
|
Esmodules []string `json:"esmodules"`
|
||||||
|
Styles []*Style `json:"styles"`
|
||||||
|
Languages []*Language `json:"languages"`
|
||||||
|
Packs []*Pack `json:"packs"`
|
||||||
|
PackFolders []*Folder `json:"packFolders"`
|
||||||
|
Relationships Relationships `json:"relationships"`
|
||||||
|
Socket bool `json:"socket"`
|
||||||
|
Protected bool `json:"protected"`
|
||||||
|
Exclusive bool `json:"exclusive"`
|
||||||
|
PersistentStorage bool `json:"persistentStorage"`
|
||||||
|
System string `json:"system"`
|
||||||
|
Background string `json:"background"`
|
||||||
|
JoinTheme string `json:"joinTheme"`
|
||||||
|
CoreVersion string `json:"coreVersion"`
|
||||||
|
SystemVersion string `json:"systemVersion"`
|
||||||
|
LastPlayed string `json:"lastPlayed"`
|
||||||
|
Playtime int `json:"playtime"`
|
||||||
|
NextSession time.Time `json:"nextSession"`
|
||||||
|
Demo Demo `json:"demo"`
|
||||||
|
Availability int `json:"availability"`
|
||||||
|
Locked bool `json:"locked"`
|
||||||
|
Owned bool `json:"owned"`
|
||||||
|
Tags []string `json:"tags"`
|
||||||
|
HasStorage bool `json:"hasStorage"`
|
||||||
|
// Flags any `json:"flags"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *World) ToDB(dest *db.World) bool {
|
||||||
|
if dest == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.ID = w.ID
|
||||||
|
dest.Title = w.Title
|
||||||
|
dest.Description = w.Description
|
||||||
|
dest.Version = w.Version
|
||||||
|
dest.Socket = w.Socket
|
||||||
|
dest.Protected = w.Protected
|
||||||
|
dest.Exclusive = w.Exclusive
|
||||||
|
dest.PersistentStorage = w.PersistentStorage
|
||||||
|
dest.System = w.System
|
||||||
|
dest.Background = w.Background
|
||||||
|
dest.JoinTheme = w.JoinTheme
|
||||||
|
dest.CoreVersion = w.CoreVersion
|
||||||
|
dest.SystemVersion = w.SystemVersion
|
||||||
|
dest.LastPlayed = w.LastPlayed
|
||||||
|
dest.Playtime = w.Playtime
|
||||||
|
dest.NextSession = w.NextSession
|
||||||
|
dest.Availability = w.Availability
|
||||||
|
dest.Locked = w.Locked
|
||||||
|
dest.Owned = w.Owned
|
||||||
|
dest.HasStorage = w.HasStorage
|
||||||
|
|
||||||
|
copy(dest.Scripts, w.Scripts)
|
||||||
|
copy(dest.Esmodules, w.Esmodules)
|
||||||
|
copy(dest.Tags, w.Tags)
|
||||||
|
|
||||||
|
w.Compatibility.ToDB(&dest.Compatibility)
|
||||||
|
w.Relationships.ToDB(&dest.Relationships)
|
||||||
|
|
||||||
|
wg := sync.WaitGroup{}
|
||||||
|
go CopySliceToDBParallel(&wg, &dest.Authors, w.Authors)
|
||||||
|
go CopySliceToDBParallel(&wg, &dest.Media, w.Media)
|
||||||
|
go CopySliceToDBParallel(&wg, &dest.Styles, w.Styles)
|
||||||
|
go CopySliceToDBParallel(&wg, &dest.Languages, w.Languages)
|
||||||
|
go CopySliceToDBParallel(&wg, &dest.Packs, w.Packs)
|
||||||
|
go CopySliceToDBParallel(&wg, &dest.PackFolders, w.PackFolders)
|
||||||
|
wg.Wait()
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
type Demo struct {
|
||||||
|
SourceZip any `json:"sourceZip"`
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user