From 992746d8ad4718f6ff9de0cd3f8ee47eabcd34b7 Mon Sep 17 00:00:00 2001 From: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> Date: Fri, 26 Sep 2025 17:11:32 -0500 Subject: [PATCH] Send system data with admin request (#68) --- api/endpoints.go | 7 +++++++ db/account.go | 11 ++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/api/endpoints.go b/api/endpoints.go index 5630bd8..a3748de 100644 --- a/api/endpoints.go +++ b/api/endpoints.go @@ -938,6 +938,13 @@ func handleAdminSearch(w http.ResponseWriter, r *http.Request) { httpError(w, r, err, http.StatusInternalServerError) return } + uuid, err = db.Store.FetchUUIDFromUsername(username) + if err == nil { + systemData, err := savedata.GetSystem(db.Store, uuid) + if err == nil { + adminSearchResult.SystemData = &systemData + } + } writeJSON(w, r, adminSearchResult) log.Printf("%s: %s searched for username %s", userDiscordId, r.URL.Path, username) diff --git a/db/account.go b/db/account.go index 6d2ec64..c22f2c3 100644 --- a/db/account.go +++ b/db/account.go @@ -199,11 +199,12 @@ func (s *store) FetchLastLoggedInDateByUsername(username string) (string, error) } type AdminSearchResponse struct { - Username string `json:"username"` - DiscordId string `json:"discordId"` - GoogleId string `json:"googleId"` - LastActivity string `json:"lastLoggedIn"` // TODO: this is currently lastLoggedIn to match server PR #54 with pokerogue PR #4198. We're hotfixing the server with this PR to return lastActivity, but we're not hotfixing the client, so are leaving this as lastLoggedIn so that it still talks to the client properly - Registered string `json:"registered"` + Username string `json:"username"` + DiscordId string `json:"discordId"` + GoogleId string `json:"googleId"` + LastActivity string `json:"lastLoggedIn"` // TODO: this is currently lastLoggedIn to match server PR #54 with pokerogue PR #4198. We're hotfixing the server with this PR to return lastActivity, but we're not hotfixing the client, so are leaving this as lastLoggedIn so that it still talks to the client properly + Registered string `json:"registered"` + SystemData *defs.SystemSaveData `json:"systemData,omitzero"` } func (s *store) FetchAdminDetailsByUsername(dbUsername string) (AdminSearchResponse, error) {