Made changes to server to allow admin panel to retrieve last activity instead of last logged in date (#58)

* Made changes to server to allow admin panel to retrieve last activity instead of last logged in date

* Added TODO comment for lastLoggedIn json result

* Updated variable names as per Pancake's comments
beta
Opaque02 2 months ago committed by GitHub
parent 07bd7fc1d1
commit c2af4a07e9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -202,25 +202,25 @@ type AdminSearchResponse struct {
Username string `json:"username"` Username string `json:"username"`
DiscordId string `json:"discordId"` DiscordId string `json:"discordId"`
GoogleId string `json:"googleId"` GoogleId string `json:"googleId"`
LastLoggedIn string `json:"lastLoggedIn"` 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"` Registered string `json:"registered"`
} }
func FetchAdminDetailsByUsername(dbUsername string) (AdminSearchResponse, error) { func FetchAdminDetailsByUsername(dbUsername string) (AdminSearchResponse, error) {
var resultUsername, resultDiscordId, resultGoogleId, resultLastLoggedIn, resultRegistered sql.NullString var username, discordId, googleId, lastActivity, registered sql.NullString
var adminResponse AdminSearchResponse var adminResponse AdminSearchResponse
err := handle.QueryRow("SELECT username, discordId, googleId, lastLoggedIn, registered from accounts WHERE username = ?", dbUsername).Scan(&resultUsername, &resultDiscordId, &resultGoogleId, &resultLastLoggedIn, &resultRegistered) err := handle.QueryRow("SELECT username, discordId, googleId, lastActivity, registered from accounts WHERE username = ?", dbUsername).Scan(&username, &discordId, &googleId, &lastActivity, &registered)
if err != nil { if err != nil {
return adminResponse, err return adminResponse, err
} }
adminResponse = AdminSearchResponse{ adminResponse = AdminSearchResponse{
Username: resultUsername.String, Username: username.String,
DiscordId: resultDiscordId.String, DiscordId: discordId.String,
GoogleId: resultGoogleId.String, GoogleId: googleId.String,
LastLoggedIn: resultLastLoggedIn.String, LastActivity: lastActivity.String,
Registered: resultRegistered.String, Registered: registered.String,
} }
return adminResponse, nil return adminResponse, nil

Loading…
Cancel
Save