Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions db/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,28 +199,28 @@ func FetchLastLoggedInDateByUsername(username string) (string, error) {
}

type AdminSearchResponse struct {
Username string `json:"username"`
DiscordId string `json:"discordId"`
GoogleId string `json:"googleId"`
LastLoggedIn string `json:"lastLoggedIn"`
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"`
}

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

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 {
return adminResponse, err
}

adminResponse = AdminSearchResponse{
Username: resultUsername.String,
DiscordId: resultDiscordId.String,
GoogleId: resultGoogleId.String,
LastLoggedIn: resultLastLoggedIn.String,
Registered: resultRegistered.String,
Username: username.String,
DiscordId: discordId.String,
GoogleId: googleId.String,
LastActivity: lastActivity.String,
Registered: registered.String,
}

return adminResponse, nil
Expand Down
Loading