projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add 'Connect' variant
[vchess.git]
/
server
/
models
/
Problem.js
diff --git
a/server/models/Problem.js
b/server/models/Problem.js
index
9978d76
..
cc74006
100644
(file)
--- a/
server/models/Problem.js
+++ b/
server/models/Problem.js
@@
-12,6
+12,7
@@
const db = require("../utils/database");
*/
const ProblemModel = {
*/
const ProblemModel = {
+
checkProblem: function(p) {
return (
p.id.toString().match(/^[0-9]+$/) &&
checkProblem: function(p) {
return (
p.id.toString().match(/^[0-9]+$/) &&
@@
-81,14
+82,15
@@
const ProblemModel = {
safeRemove: function(id, uid, devs) {
db.serialize(function() {
safeRemove: function(id, uid, devs) {
db.serialize(function() {
- let whereClause = "WHERE id = " +
prob.
id;
+ let whereClause = "WHERE id = " + id;
if (!devs.includes(uid)) whereClause += " AND uid = " + uid;
const query =
"DELETE FROM Problems " +
whereClause;
db.run(query);
});
if (!devs.includes(uid)) whereClause += " AND uid = " + uid;
const query =
"DELETE FROM Problems " +
whereClause;
db.run(query);
});
- },
-}
+ }
+
+};
module.exports = ProblemModel;
module.exports = ProblemModel;