Added new endpoints to sync the list of games from steam if a user logged in.

This commit is contained in:
Andreas Dahm committed 2026-05-04 11:47:26 +02:00
1 parent ac97442312
commit 2f3507b57b
23 files changed
+749 -18

No files matched your search

+24 -1
View File
@@ -43,4 +43,27 @@ app:
steam:
api-key: ${STEAM_API_KEY}
base-url: https://api.steampowered.com
imageService-url: https://cdn.cloudflare.steamstatic.com/steam/apps/
imageService-url: https://cdn.cloudflare.steamstatic.com/steam/apps/
library:
sync-ttl-hours: 24
force-sync-cooldown-seconds: 60
running-stale-minutes: 5
resilience4j:
retry:
instances:
steamApi:
max-attempts: 3
wait-duration: 500ms
enable-exponential-backoff: true
exponential-backoff-multiplier: 2
retry-exceptions:
- org.springframework.web.client.RestClientException
- org.springframework.web.client.ResourceAccessException
ratelimiter:
instances:
steamApi:
# Steam allows ~100k req/day. Cap at ~2 req/s to leave headroom for bursts.
limit-for-period: 2
limit-refresh-period: 1s
timeout-duration: 5s
@@ -0,0 +1,27 @@
-- Global Steam game catalog. Shared across users to avoid duplicating metadata.
CREATE TABLE steam_game (
appid BIGINT PRIMARY KEY,
name VARCHAR(512) NOT NULL,
img_icon_url VARCHAR(512),
last_seen_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
-- Per-user ownership and playtime. Soft-delete via removed_at.
CREATE TABLE user_game (
user_id BIGINT NOT NULL,
appid BIGINT NOT NULL REFERENCES steam_game(appid),
playtime_minutes INTEGER NOT NULL DEFAULT 0,
first_seen_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
last_seen_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
removed_at TIMESTAMPTZ,
PRIMARY KEY (user_id, appid)
);
CREATE INDEX idx_user_game_user_active ON user_game (user_id) WHERE removed_at IS NULL;
-- Per-user Steam sync state. Owned by Core to avoid coupling Auth schema.
CREATE TABLE user_steam_sync (
user_id BIGINT PRIMARY KEY,
steam_id VARCHAR(32) NOT NULL,
last_synced_at TIMESTAMPTZ,
last_sync_status VARCHAR(16)
);