Module: Database

Methods

(async, inner) attemptLogin(username, password) → {boolean}

Function to check if provided user information is valid.
Parameters:
Name Type Description
username string Name of user we are trying to log in as.
password string Password of user we are trying to log in as.
Source:
Returns:
Type
boolean

(async, inner) getHistory(username) → {Array.<object>}

Function to query the database for a user's history.
Parameters:
Name Type Description
username string Name of user we are requesting the history of.
Source:
Returns:
Type
Array.<object>

(async, inner) getLeaderboards() → {Array.<object>}

Function to query the database for the top games and users.
Source:
Returns:
Type
Array.<object>

(async, inner) getUser(username) → {object}

Function to return either an empty object or valid user object.
Parameters:
Name Type Description
username string Name of user we are searching for.
Source:
Returns:
Type
object

(async, inner) register(username, password)

Function to register a new user.
Parameters:
Name Type Description
username string Name of user to be registered.
password string Password of user to be registered.
Source:

(async, inner) saveGame(username, score)

Function to save a game to the database.
Parameters:
Name Type Description
username string The user who completed the game.
score int The game's score.
Source: