The Renovate branches changed go.mod and package.json without go.sum or package-lock.json, so this tidies the module graph, regenerates the gqlgen code for v0.17.98 and refreshes the lockfile. katex stays on 0.16: @mdit/plugin-katex renders with its own katex ^0.16 and Markdown.vue loads only the stylesheet from the top-level package, so 0.19's CSS would no longer match the rendered HTML. renovate.json5 now caps it below 0.17 so the bump is not proposed again. Co-Authored-By: Claude Opus 5.5 <[email protected]>
54 lines
1.4 KiB
Go
54 lines
1.4 KiB
Go
package graph
|
|
|
|
// This file will be automatically regenerated based on the schema, any resolver
|
|
// implementations
|
|
// will be copied through when generating and any unknown code will be moved to the end.
|
|
// Code generated by github.com/99designs/gqlgen version v0.17.98
|
|
|
|
import (
|
|
"context"
|
|
|
|
"adam-french.co.uk/backend/graph/model"
|
|
"adam-french.co.uk/backend/services"
|
|
)
|
|
|
|
// SteamStatus is the resolver for the steamStatus field.
|
|
func (r *queryResolver) SteamStatus(ctx context.Context) (*model.SteamStatus, error) {
|
|
if r.Store.SteamAPIKey == "" {
|
|
return nil, nil
|
|
}
|
|
|
|
// Five-minute cache across both Steam calls, which are made together and
|
|
// expire together.
|
|
if games, online, ok := r.Store.CachedSteam(); ok {
|
|
return &model.SteamStatus{
|
|
Online: online,
|
|
RecentGames: mapSteamGames(games),
|
|
}, nil
|
|
}
|
|
|
|
games, err := services.FetchRecentlyPlayedGames(r.Store.SteamAPIKey, r.Store.SteamID)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
summary, err := services.FetchPlayerSummary(r.Store.SteamAPIKey, r.Store.SteamID)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
// PersonaState 0 is offline; every higher value is some flavour of
|
|
// online. A nil summary (private profile) reads as offline.
|
|
online := false
|
|
if summary != nil {
|
|
online = summary.PersonaState > 0
|
|
}
|
|
|
|
r.Store.SetSteam(games, online)
|
|
|
|
return &model.SteamStatus{
|
|
Online: online,
|
|
RecentGames: mapSteamGames(games),
|
|
}, nil
|
|
}
|