X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=server%2Fmodels%2FVariant.js;h=f439e192f2930bc93ead353cdadc2af8fcb19b49;hb=81b71035639a4204bd7834c9185ea961755af1cf;hp=ae417932c31d0dfe9f10de5af57cb4bf0ebfed8f;hpb=98db2082fd31e7a7bc0348e31ce119f39dbc31b3;p=vchess.git diff --git a/server/models/Variant.js b/server/models/Variant.js index ae417932..f439e192 100644 --- a/server/models/Variant.js +++ b/server/models/Variant.js @@ -1,59 +1,28 @@ -var db = require("../utils/database"); +const db = require("../utils/database"); /* * Structure: * id: integer * name: varchar + * display: varchar + * groupe: integer * description: varchar + * noProblems: boolean */ -const VariantModel = -{ - // This is duplicated in client. TODO: really required here? - NbPlayers: - { - "Alice": [2,3,4], - "Antiking": [2,3,4], - "Atomic": [2,3,4], - "Baroque": [2,3,4], - "Berolina": [2,4], - "Checkered": [2,3,4], - "Chess960": [2,3,4], - "Crazyhouse": [2,3,4], - "Dark": [2,3,4], - "Extinction": [2,3,4], - "Grand": [2], - "Losers": [2,3,4], - "Magnetic": [2], - "Marseille": [2], - "Switching": [2,3,4], - "Upsidedown": [2], - "Wildebeest": [2], - "Zen": [2,3,4], - }, +const VariantModel = { - getByName: function(name, callback) - { - db.serialize(function() { - const query = - "SELECT * " + - "FROM Variants " + - "WHERE name='" + name + "'"; - db.get(query, callback); - }); - }, + getAll: function(callback) { + db.serialize(function() { + const query = + "SELECT * " + + "FROM Variants"; + db.all(query, callback); + }); + } - getAll: function(callback) - { - db.serialize(function() { - const query = - "SELECT * " + - "FROM Variants"; - db.all(query, callback); - }); - }, + //create, update, delete: directly in DB - //create, update, delete: directly in DB -} +}; module.exports = VariantModel;