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
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"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) {
|
||||
@@ -12,7 +16,22 @@ func (app *application) ShowText(w http.ResponseWriter, r *http.Request) {
|
||||
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) {
|
||||
|
||||
@@ -108,7 +108,7 @@ func (app *application) parseFlags() *requests.FoundryHttpRequest {
|
||||
return &foundryHttpData
|
||||
}
|
||||
|
||||
// TODO: Handle grace application exit
|
||||
// TODO: Handle DB connection error
|
||||
func main() {
|
||||
app := application{foundryApp: &foundry.FoundryApi{}}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user