feat: add system requirements, store stats, and pricing to game schema and steam sync

This commit is contained in:
2026-04-28 23:13:08 +08:00
parent 7e2ab978e1
commit 799bfbbf31
6 changed files with 1786 additions and 0 deletions
+21
View File
@@ -11,6 +11,14 @@ interface SteamAppDetails {
genres?: { id: string; description: string }[]
website?: string
short_description?: string
pc_requirements?: { minimum?: string; recommended?: string }
metacritic?: { score: number; url: string }
recommendations?: { total: number }
price_overview?: { currency: string; initial: number; final: number }
is_free?: boolean
release_date?: { coming_soon: boolean; date: string }
categories?: { id: string; description: string }[]
platforms?: { windows: boolean; mac: boolean; linux: boolean }
}
const SEVEN_DAYS_MS = 7 * 24 * 60 * 60 * 1000
@@ -60,6 +68,19 @@ export async function syncSteamGame(steamAppId: number): Promise<void> {
headerImage: d.header_image || null,
capsuleImage: `https://cdn.akamai.steamstatic.com/steam/apps/${steamAppId}/library_600x900.jpg`,
storeUrl: `https://store.steampowered.com/app/${steamAppId}`,
systemRequirements: d.pc_requirements
? { minimum: d.pc_requirements.minimum || null, recommended: d.pc_requirements.recommended || null }
: null,
metacriticScore: d.metacritic?.score ?? null,
metacriticUrl: d.metacritic?.url ?? null,
recommendationsTotal: d.recommendations?.total ?? null,
priceCurrent: d.price_overview?.final ?? null,
priceInitial: d.price_overview?.initial ?? null,
priceCurrency: d.price_overview?.currency ?? null,
isFree: d.is_free ?? false,
releaseDate: d.release_date?.date ?? null,
categories: d.categories?.map((c) => c.description) ?? null,
platforms: d.platforms ?? null,
lastSync: new Date(),
syncStatus: "synced",
updatedAt: new Date(),