scaffolding

This commit is contained in:
2024-11-12 16:22:30 +02:00
parent 7180cfeb7f
commit c2245d92b3
9 changed files with 345 additions and 2 deletions
+102
View File
@@ -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 }