mirror of
https://github.com/pagefaultgames/rogueserver.git
synced 2025-04-02 02:57:15 +08:00
ServerSide adjustments for Run History function
This commit is contained in:
parent
8577d7978b
commit
e66c44bbba
@ -31,7 +31,6 @@ import (
|
||||
"github.com/pagefaultgames/rogueserver/db"
|
||||
"github.com/pagefaultgames/rogueserver/defs"
|
||||
|
||||
"/api/savedata"
|
||||
)
|
||||
|
||||
/*
|
||||
@ -575,8 +574,8 @@ func handleGetRunHistory(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
var runHistory any
|
||||
runHistory, err = savedata.GetRunHistoryData(uuid);
|
||||
var runHistory defs.RunHistoryData
|
||||
runHistory, err = db.GetRunHistoryData(uuid);
|
||||
|
||||
if errors.Is(err, sql.ErrNoRows) {
|
||||
http.Error(w, err.Error(), http.StatusNotFound)
|
||||
@ -598,14 +597,14 @@ func handleRunHistory(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
var data string
|
||||
var data defs.RunHistoryData
|
||||
err = json.NewDecoder(r.Body).Decode(&data)
|
||||
if err != nil {
|
||||
httpError(w, r, fmt.Errorf("failed to decode request body: %s", err), http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
err = savedata.UpdateRunHistoryData(uuid, data)
|
||||
err = db.UpdateRunHistoryData(uuid, data)
|
||||
if err != nil {
|
||||
httpError(w, r, err, http.StatusInternalServerError)
|
||||
return
|
||||
|
@ -140,4 +140,4 @@ type SessionHistoryData struct {
|
||||
|
||||
type SessionHistoryResult int
|
||||
|
||||
type RunHistoryData map[int]interface{}
|
||||
type RunHistoryData map[string]interface{}
|
||||
|
Loading…
x
Reference in New Issue
Block a user