+getRepetitionStatus() lose or draw... (for some variants)
+Chakart: king remote capture, is an option if short range
+
WON'T IMPLEMENT:
Simultaneous games: view Game + Simultaneous, using component (One)Game
Storage: just key ID => IDs of actual games (in indexedDB)
// Remove item(s) in array (if present)
export const ArrayFun = {
+
remove: function(arr, rfun, all) {
const index = arr.findIndex(rfun);
if (index >= 0) {
range: function(max) {
return [...Array(max).keys()];
}
+
};
}
export const CompgameStorage = {
+
add: function(game) {
dbOperation((err, db) => {
if (err) return;
}
});
}
+
};
}
export const GameStorage = {
+
// Optional callback to get error status
add: function(game, callback) {
dbOperation((err, db) => {
}
});
}
+
};
}
export const ImportgameStorage = {
+
// Optional callback to get error status
add: function(game, callback) {
dbOperation((err, db) => {
}
});
}
+
};
module.exports = {
+
// For mail sending. NOTE: *no trailing slash*
siteURL: "http://localhost:8080",
// IDs of users allowed to post news and edit any problem
devs: []
+
};
*/
const ChallengeModel = {
+
checkChallenge: function(c) {
return (
c.vid.toString().match(/^[0-9]+$/) &&
ChallengeModel.remove(id);
});
});
- },
-}
+ }
+
+};
module.exports = ChallengeModel;
* added: datetime
*/
-const GameModel =
-{
+const GameModel = {
+
checkGameInfo: function(g) {
return (
g.vid.toString().match(/^[0-9]+$/) &&
});
});
}
-}
+
+};
module.exports = GameModel;
*/
const ProblemModel = {
+
checkProblem: function(p) {
return (
p.id.toString().match(/^[0-9]+$/) &&
whereClause;
db.run(query);
});
- },
-}
+ }
+
+};
module.exports = ProblemModel;
*/
const UserModel = {
+
checkNameEmail: function(o) {
return (
(!o.name || !!(o.name.match(/^[\w-]+$/))) &&
}
});
});
- },
-}
+ }
+
+};
module.exports = UserModel;
*/
const VariantModel = {
+
getAll: function(callback) {
db.serialize(function() {
const query =
"FROM Variants";
db.all(query, callback);
});
- },
+ }
//create, update, delete: directly in DB
-}
+
+};
module.exports = VariantModel;
var UserModel = require("../models/User");
module.exports = {
+
// Prevent access to "users pages"
logged: function(req, res, next) {
const callback = () => {
res.json({ errmsg: msg });
} else cb();
}
+
};