Esempio n. 1
0
exports.index = function (req, res) {
  logging.vog('GET /users');

  gameHelper.indexQ()
    .then(function (games) {
      res.send(games);
    })
    .fail(responseUtils.sendBadRequestCallback(res))
    .done();
};
Esempio n. 2
0
exports.index = function (req, res) {
  logging.vvog('GET /historys');

  historyHelper.indexQ()
    .then(function (historys) {
      res.send(historys);
    })
    .fail(responseUtils.sendBadRequestCallback(res))
    .done();
};
Esempio n. 3
0
exports.index = function (req, res) {
  logging.vog('GET /ruleBundles');

  ruleBundleHelper.indexQ()
    .then(function (ruleBundles) {
      res.send(ruleBundles);
    })
    .fail(responseUtils.sendBadRequestCallback(res))
    .done();
};
Esempio n. 4
0
exports.read = function (req, res) {
  logging.vog('GET /games/:id', req.params.id);

  gameHelper.readQ(req.params.id)
    .then(function (game){
      if (!game) {
        responseUtils.sendNotFoundError(res, 'Not Found');
      } else
        res.send(game);
    })
    .fail(responseUtils.sendBadRequestCallback(res))
    .done();
};
Esempio n. 5
0
 .then(function (gameBoard){
   if (!gameBoard) {
     responseUtils.sendNotFoundError(res, 'Game->GameBoard: Not Found');
   } else {
     helperFunction(gameBoard.history)
       .then(function (history){
         if (!history) {
           responseUtils.sendNotFoundError(res, 'Game->GameBoard->History: Not Found');
         } else
           res.send(history);
       })
       .fail(responseUtils.sendBadRequestCallback(res))
       .done();
   }
 })
Esempio n. 6
0
 .done(function (foundGame) {
   if (!foundGame) {
     responseUtils.sendNotFoundError(res, 'Game: Not Found');
   } else {
     gameBoardHelper.readQ(foundGame.gameBoard)
       .then(function (gameBoard){
         if (!gameBoard) {
           responseUtils.sendNotFoundError(res, 'Game->GameBoard: Not Found');
         } else
           res.send(gameBoard);
       })
       .fail(responseUtils.sendBadRequestCallback(res))
       .done();
   }
 }, responseUtils.sendNotFoundErrorCallback(res));