87 lines
1.6 KiB
JavaScript
87 lines
1.6 KiB
JavaScript
|
|
/**
|
|
* Games manager class
|
|
*/
|
|
class GamesManager{
|
|
name = 'games';
|
|
|
|
/**
|
|
* Class initializer
|
|
* @param {App} app Class initializer
|
|
*/
|
|
init(app){
|
|
const {db} = app;
|
|
|
|
/**
|
|
* Creates a new game definition
|
|
* @param {Context} ctx Request context
|
|
* @param {Game} data the game description
|
|
*/
|
|
this.create = async function(ctx, data){
|
|
|
|
}
|
|
|
|
/**
|
|
* Reads game definition by ID
|
|
* @param {Number} id game ID
|
|
* @returns {Game} the game
|
|
*/
|
|
this.read = async function(id){
|
|
|
|
}
|
|
|
|
/**
|
|
* Updates game definition
|
|
* @param {Context} ctx Request context
|
|
* @param {Game} data the game description
|
|
*/
|
|
this.update = async function(ctx, data){
|
|
|
|
}
|
|
|
|
/**
|
|
* Removes game by ID
|
|
* @param {Number} id game definition ID
|
|
*/
|
|
this.remove = async function(id){
|
|
|
|
}
|
|
|
|
/**
|
|
* Returns a set of games by given criteria
|
|
* @param {Query} query criteria
|
|
* @returns {Game[]} Array of games
|
|
*/
|
|
this.list = async function(query){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/**
|
|
* Class starter
|
|
* @param {App} app The application
|
|
*/
|
|
async start(app){
|
|
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Game entity
|
|
*/
|
|
class Game {
|
|
/**
|
|
* Game name
|
|
* @type {string}
|
|
*/
|
|
name = null;
|
|
|
|
/**
|
|
* Game scenario
|
|
* @type { Scenario }
|
|
*/
|
|
scenario = null;
|
|
}
|
|
|
|
export { GamesManager } |