scaffolding
This commit is contained in:
@@ -0,0 +1,102 @@
|
||||
|
||||
/**
|
||||
* 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}
|
||||
*/
|
||||
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[]}
|
||||
*/
|
||||
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 formal description
|
||||
* @type GameDefinition
|
||||
*/
|
||||
definition = {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
levels:[
|
||||
{
|
||||
name: 'Level 1',
|
||||
environment: null,
|
||||
objects:[
|
||||
{
|
||||
id: 15
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
}
|
||||
|
||||
export { GamesManager }
|
||||
@@ -0,0 +1,82 @@
|
||||
|
||||
/**
|
||||
* Rules manager class
|
||||
*/
|
||||
class RulesManager{
|
||||
name = 'rules';
|
||||
|
||||
/**
|
||||
* Class initializer
|
||||
* @param {App} app Class initializer
|
||||
*/
|
||||
init(app){
|
||||
const {db} = app;
|
||||
|
||||
/**
|
||||
* Creates a new rule
|
||||
* @param {Context} ctx Request context
|
||||
* @param {Rule} data the rule
|
||||
*/
|
||||
this.create = async function(ctx, data){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads rule by ID
|
||||
* @param {Number} id rule ID
|
||||
* @returns {Rule}
|
||||
*/
|
||||
this.read = async function(id){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates rule
|
||||
* @param {Context} ctx Request context
|
||||
* @param {Rule} data the rule
|
||||
*/
|
||||
this.update = async function(ctx, data){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes rule by ID
|
||||
* @param {Number} id rule ID
|
||||
*/
|
||||
this.remove = async function(id){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a set of rules by given criteria
|
||||
* @param {Query} query criteria
|
||||
* @returns {Rule[]}
|
||||
*/
|
||||
this.list = async function(query){
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Class starter
|
||||
* @param {App} app The application
|
||||
*/
|
||||
async start(app){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Rule entity
|
||||
*/
|
||||
class Rule {
|
||||
/**
|
||||
* Rule name
|
||||
* @type string
|
||||
*/
|
||||
name = null;
|
||||
|
||||
}
|
||||
|
||||
export { RulesManager }
|
||||
@@ -0,0 +1,82 @@
|
||||
|
||||
/**
|
||||
* Scenarios manager class
|
||||
*/
|
||||
class ScenariosManager{
|
||||
name = 'scenarios';
|
||||
|
||||
/**
|
||||
* Class initializer
|
||||
* @param {App} app Class initializer
|
||||
*/
|
||||
init(app){
|
||||
const {db} = app;
|
||||
|
||||
/**
|
||||
* Creates a new scenario
|
||||
* @param {Context} ctx Request context
|
||||
* @param {Scenario} data the scenario
|
||||
*/
|
||||
this.create = async function(ctx, data){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads scenario by ID
|
||||
* @param {Number} id scenario ID
|
||||
* @returns {Scenario}
|
||||
*/
|
||||
this.read = async function(id){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates scenario
|
||||
* @param {Context} ctx Request context
|
||||
* @param {Scenario} data the scenario
|
||||
*/
|
||||
this.update = async function(ctx, data){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes scenario by ID
|
||||
* @param {Number} id scenario ID
|
||||
*/
|
||||
this.remove = async function(id){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a set of scenarios by given criteria
|
||||
* @param {Query} query criteria
|
||||
* @returns {Scenario[]}
|
||||
*/
|
||||
this.list = async function(query){
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Class starter
|
||||
* @param {App} app The application
|
||||
*/
|
||||
async start(app){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Scenario entity
|
||||
*/
|
||||
class Scenario {
|
||||
/**
|
||||
* Scenario name
|
||||
* @type string
|
||||
*/
|
||||
name = null;
|
||||
|
||||
}
|
||||
|
||||
export { ScenariosManager }
|
||||
Reference in New Issue
Block a user