add db connection, refactor code, add db migration files
This commit is contained in:
@@ -1,15 +1,13 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/models"
|
||||
)
|
||||
|
||||
func (app *application) ShowText(w http.ResponseWriter, r *http.Request) {
|
||||
msg := app.foundryApp.CreateWSMessageByPage("/join")
|
||||
data, err := app.foundryApp.HandleWebsocketRequest(msg)
|
||||
data, err := app.foundryApp.HandleWSRequest("/join")
|
||||
if err != nil {
|
||||
app.slogger.Error("", "error", err)
|
||||
w.Write([]byte(err.Error()))
|
||||
@@ -29,8 +27,7 @@ func (app *application) ShowText(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (app *application) WhenNextSession(w http.ResponseWriter, r *http.Request) {
|
||||
msg := app.foundryApp.CreateWSMessageByPage("/setup")
|
||||
data, err := app.foundryApp.HandleWebsocketRequest(msg)
|
||||
data, err := app.foundryApp.HandleWSRequest("/setup")
|
||||
if err != nil {
|
||||
app.slogger.Error("", "error", err)
|
||||
w.Write([]byte(err.Error()))
|
||||
@@ -50,7 +47,7 @@ func (app *application) WhenNextSession(w http.ResponseWriter, r *http.Request)
|
||||
w.Write([]byte(err.Error()))
|
||||
return
|
||||
}
|
||||
fmt.Printf("JSON msg: %s\n", nextSession)
|
||||
|
||||
app.slogger.Info("Next session data is ready to send", "sessionTime", nextSession)
|
||||
w.Write([]byte(nextSession.Local().String()))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user