How to use the rest-hapi.addOne function in rest-hapi

To help you get started, we’ve selected a few rest-hapi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github JKHeadley / appy-backend / server / api / chat.js View on Github external
const markAsReadHandler = function (request, reply) {
      const Conversation = mongoose.model('conversation');
      const User = mongoose.model('user');

      return RestHapi.addOne(Conversation, request.params._id, User, request.auth.credentials.user._id, 'userData', { hasRead: true })
        .then(function (result) {
          return reply(result)
        })
        .catch(function (error) {
          Log.error(error);
          return reply(RestHapi.errorHelper.formatResponse(error));
        });
    };