Guest User

Untitled

a guest
Dec 16th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. {
  2. method: 'PUT',
  3. path: '/v1/Admin/UserblockUnblock',
  4. config: {
  5. description: 'API for user account block or unblock.. 1-block 2-unblock',
  6. notes: 'API for user account block or unblock.. 1-block 2-unblock',
  7. tags: ['api'],
  8. pre: [
  9. { method: Utils.universalFunctions.verifyLoginToken, assign: "userDetails" }
  10. ],
  11. validate: {
  12. payload: {
  13. userid: Utils.Joi.string().length(24).trim().required().error(new Error('User Id is invalid.')),
  14. type: Utils.Joi.number().required().valid(1, 2), //1-block,2-Unblock
  15. messae:Utils.Joi.string().lowercase().required().label('message'),
  16. },
  17. headers: Utils.Joi.object({
  18. 'x-logintoken': Utils.Joi.string().required().trim()
  19. }).options({allowUnknown: true})
  20. }
  21. },
  22. handler: function (request, reply) {
  23. request.payload.userDetails = request.pre.userDetails[0]
  24. adminService.blockunblockuser(request.payload,function (err, res) {
  25. if (err) {
  26. reply(err)
  27. } else {
  28. reply(res)
  29. }
  30. });
  31. }
  32. },
Add Comment
Please, Sign In to add comment