+router.post("/problems", access.logged, access.ajax, (req,res) => {
+ if (ProblemModel.checkProblem(req.body.prob))
+ {
+ const problem =
+ {
+ vid: req.body.prob.vid,
+ fen: req.body.prob.fen,
+ uid: req.userId,
+ instruction: sanitizeHtml(req.body.prob.instruction),
+ solution: sanitizeHtml(req.body.prob.solution),
+ };
+ ProblemModel.create(problem, (err,ret) => {
+ res.json(err || {id:ret.pid});
+ });
+ }
+ else
+ res.json({});
+});
+
+router.get("/problems", access.ajax, (req,res) => {