Constructor
new GameRepository(db)
Parameters:
Name | Type | Description |
---|---|---|
db |
Database | sqlite connection |
Methods
(async) addGameToUser(gameId, username)
Add a Game to a User
Parameters:
Name | Type | Description |
---|---|---|
gameId |
int | |
username |
string |
Returns:
string sql response of the command
(async) createGameTable()
Create the Table games if not exist
Returns:
string sql response of the command
(async) createGameUserMappingTable()
Create the Table gameUserMapping if not exist
Returns:
string sql response of the command
(async) deleteGame(gameId)
Delete a game from the DB
Parameters:
Name | Type | Description |
---|---|---|
gameId |
int |
(async) insertNewGame(game, platformID)
Add a new Game to the DB
Parameters:
Name | Type | Description |
---|---|---|
game |
GameCreate | Game to Add |
platformID |
int | Id |
Returns:
string sql response of the command
(async) removeGameFromUser(gameId, username)
Delete a Game that was added to a User
Parameters:
Name | Type | Description |
---|---|---|
gameId |
int | |
username |
string |
Returns:
string sql response of the command
(async) selectAll() → {Array.<Game>}
Return all saved Games
Returns:
- Type
- Array.<Game>
(async) selectAllGamesFromUser(username) → {Array.<Game>}
Get all Games from a User
Parameters:
Name | Type | Description |
---|---|---|
username |
string |
Returns:
- Type
- Array.<Game>
(async) selectAllGamesWithPlatformByUser(platformName, username)
Get all Games from a User for a specific platform
Parameters:
Name | Type | Description |
---|---|---|
platformName |
string | |
username |
string |
Returns:
string sql response of the command
(async) selectByID(id)
Get a Game by his id
Parameters:
Name | Type | Description |
---|---|---|
id |
string |
Returns:
Game
(async) selectByName(name)
Get a Game by his name
Parameters:
Name | Type | Description |
---|---|---|
name |
string |
Returns:
Game
(async) selectUsersOfGame(gameId) → {Array.<string>}
Get all Usernames that have this game
Parameters:
Name | Type | Description |
---|---|---|
gameId |
string |
Returns:
- Type
- Array.<string>