add new models, change migration files, prepare to add all new tables from models
This commit is contained in:
@@ -2,12 +2,14 @@ package foundry
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/actions"
|
||||
"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/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)
|
||||
foundry.transport.CurrWsId++
|
||||
|
||||
@@ -226,8 +228,18 @@ func (foundry *FoundryApi) Test() ([]byte, error) {
|
||||
if err != nil {
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user