Class: GameRepository

GameRepository(db)

Contain functions to interact with the Game in the DBs

Constructor

new GameRepository(db)

Parameters:
Name Type Description
db Database sqlite connection
Source:

Methods

(async) addGameToUser(gameId, username)

Add a Game to a User
Parameters:
Name Type Description
gameId int
username string
Source:
Returns:
string sql response of the command

(async) createGameTable()

Create the Table games if not exist
Source:
Returns:
string sql response of the command

(async) createGameUserMappingTable()

Create the Table gameUserMapping if not exist
Source:
Returns:
string sql response of the command

(async) deleteGame(gameId)

Delete a game from the DB
Parameters:
Name Type Description
gameId int
Source:

(async) insertNewGame(game, platformID)

Add a new Game to the DB
Parameters:
Name Type Description
game GameCreate Game to Add
platformID int Id
Source:
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
Source:
Returns:
string sql response of the command

(async) selectAll() → {Array.<Game>}

Return all saved Games
Source:
Returns:
Type
Array.<Game>

(async) selectAllGamesFromUser(username) → {Array.<Game>}

Get all Games from a User
Parameters:
Name Type Description
username string
Source:
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
Source:
Returns:
string sql response of the command

(async) selectByID(id)

Get a Game by his id
Parameters:
Name Type Description
id string
Source:
Returns:
Game

(async) selectByName(name)

Get a Game by his name
Parameters:
Name Type Description
name string
Source:
Returns:
Game

(async) selectUsersOfGame(gameId) → {Array.<string>}

Get all Usernames that have this game
Parameters:
Name Type Description
gameId string
Source:
Returns:
Type
Array.<string>