feat: Add Games (#276)

## Description
<!-- Briefly describe the purpose and scope of your changes -->


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Introduced comprehensive management of game libraries, including
adding, removing, and listing games in a user's Steam library.
- Added new API endpoints for retrieving detailed game information by ID
and listing all games in a user's library.
- Enabled friend-related API endpoints to list friends and fetch friend
details by SteamID.
- Added category and base game data structures with validation and
serialization for enriched game metadata.
- Introduced ownership update functionality for Steam accounts during
login.
- Added new game and category linking to support detailed game metadata
and categorization.
- Introduced member retrieval functions for enhanced team and user
management.

- **Improvements**
- Enhanced authentication to enforce team membership checks and provide
member-level access control.
- Improved Steam account ownership handling to ensure accurate user
association.
  - Added indexes to friend relationships for optimized querying.
  - Refined API routing structure with added game and friend routes.
- Improved friend listing queries for efficiency and data completeness.

- **Bug Fixes**
  - Fixed formatting issues in permissions related to Steam accounts.

- **Other**
- Refined event handling for user account refresh based on user ID
instead of email.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Wanjohi
2025-05-10 08:11:00 +03:00
committed by GitHub
parent d933c1e61d
commit 0b995fa540
23 changed files with 1120 additions and 142 deletions

View File

@@ -90,6 +90,11 @@ export namespace Examples {
variants: [ProductVariant]
}
export const Friend = {
...Examples.SteamAccount,
user: Examples.User
}
export const Subscription = {
id: Id("subscription"),
teamID: Team.id,
@@ -143,36 +148,76 @@ export namespace Examples {
slug: "remedy_entertainment",
}
export const BaseGame = {
id: "1809540",
slug: "nine-sols",
name: "Nine Sols",
controllerSupport: "full",
releaseDate: new Date("2024-05-29T06:53:24.000Z"),
compatibility: "high" as const,
size: {
downloadSize: 7907568608,// 7.91 GB
sizeOnDisk: 13176088178,// 13.18 GB
},
primaryGenre: "Action",
score: 4.7,
description: "Nine Sols is a lore rich, hand-drawn 2D action-platformer featuring Sekiro-inspired deflection focused combat. Embark on a journey of eastern fantasy, explore the land once home to an ancient alien race, and follow a vengeful heros quest to slay the 9 Sols, formidable rulers of this forsaken realm.",
}
export const Categories = {
genres: [
{
name: "Action",
slug: "action"
},
{
name: "Adventure",
slug: "adventure"
},
{
name: "Indie",
slug: "indie"
}
],
tags: [
{
name: "Metroidvania",
slug: "metroidvania",
},
{
name: "Souls-like",
slug: "souls-like",
},
{
name: "Difficult",
slug: "difficult",
},
],
developers: [
{
name: "RedCandleGames",
slug: "redcandlegames"
}
],
publishers: [
{
name: "RedCandleGames",
slug: "redcandlegames"
}
],
}
export const Game = {
id: Id("game"),
appID: 870780,
name: "Control Ultimate Edition",
slug: "control-ultimate-edition",
tags: [GameTag], // Examples; Multiplayer, Family Sharing, Free To Play, Full Controller Support, In Game Purchases, Native Linux, Proton Compatibility Max (3), Proton Compatibility Mid (2), Proton Compatibility Low (1)
genres: [GameGenre], // Examples; Action, Adventure,
website: "https://controlgame.com",
legalNotice: "Control © Remedy Entertainment Plc 2019. The Remedy, Northlight and Control logos are trademarks of Remedy Entertainment Plc. 505 Games and the 505 Games logo are trademarks of 505 Games SpA, and may be registered in the United States and other countries. All rights reserved.",
releaseDate: new Date("27 Aug, 2020"),
description: "Winner of over 80 awards, Control is a visually stunning third-person action-adventure that will keep you on the edge of your seat.",
ratings: [GameRating],
publishers: [{ ...DevelopmentTeam, type: "publisher" as const }],
developers: [DevelopmentTeam],
...BaseGame,
...Categories
}
export const image = {
type: "screenshot" as const, // or square, vertical, horizontal, movie
hash: "3a5e805fd4c1e04e26a97af0b9c6fab2dee91a19",
gameID: Game.id,
extractedColors: [{}]
}
// export const Machine = {
// id: Id("machine"),
// userID: Id("user"),
// country: "Kenya",
// countryCode: "KE",
// timezone: "Africa/Nairobi",
// location: { latitude: 36.81550, longitude: -1.28410 },
// fingerprint: "fc27f428f9ca47d4b41b707ae0c62090",
// export const image = {
// type: "screenshot" as const, // or square, vertical, horizontal, movie
// hash: "3a5e805fd4c1e04e26a97af0b9c6fab2dee91a19",
// gameID: Game.id,
// extractedColors: [{}]
// }
}