8d7eba25ab350803824b0d830ff1280815b2df02
[vchess.git] / models / Variant.js
1 var db = require("../utils/database");
2
3 /*
4 * Structure:
5 * id: integer
6 * name: varchar
7 * description: varchar
8 */
9
10 exports.getByName = function(name, callback)
11 {
12 db.serialize(function() {
13 const query =
14 "SELECT * " +
15 "FROM Variants " +
16 "WHERE name='" + name + "'";
17 db.get(query, callback);
18 });
19 }
20
21 exports.getAll = function(callback)
22 {
23 db.serialize(function() {
24 const query =
25 "SELECT * " +
26 "FROM Variants";
27 db.all(query, callback);
28 });
29 }
30
31 //create, update, delete: directly in DB