async function updatePost(req, res, next) {
  const body = filteredBody(req.body, contants.WHITELIST.posts.update);
  try {
    const post = await Post.findById(req.params.id);

    if (post.author.toString() !== req.user._id.toString()) {
      return res.sendStatus(HTTPStatus.UNAUTHORIZED);
    }

    Object.keys(body).forEach(key => {
      post[key] = body[key];
    });

    return res.status(HTTPStatus.OK).json(await post.save());
  } catch (err) {
    err.status = HTTPStatus.BAD_REQUEST;
    return next(err);
  }
}
@api {patch} /posts/:id Update a post
@apiDescription Update a post if the author it's the right one
@apiName updatePost
@apiGroup Post

@apiHeader {Authorization} Authorization JWT Token

@apiParam {String} id Post unique ID.

@apiParam (Body) {String} [title] Post title.
@apiParam (Body) {String} [text] Post text.

@apiSuccess {Number} status Status of the Request.
@apiSuccess {Object} post Post updated.
@apiSuccess {String} post._id Post _id.
@apiSuccess {String} post.title Post title.
@apiSuccess {String} post.text Post text.
@apiSuccess {String} post.author Post author id.
@apiSuccess {String} post.createdAt Post created date.

@apiParam (Login) {String} pass Only logged in users can do this.

@apiHeaderExample {json} Header-Example:
{
 "AUTHORIZATION": "JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI1OTBhMWI3ODAzMDI3N2NiNjQxM2JhZGUiLCJpYXQiOjE0OTM4MzQ2MTZ9.RSlMF6RRwAALZQRdfKrOZWnuHBk-mQNnRcCLJsc8zio"
}

@apiSuccessExample Success-Response:

HTTP/1.1 200 OK

{
 _id: '123',
 title: 'New title',
 text: 'New text',
 createdAt: '2017-05-03',
 author: '123312'
}

@apiErrorExample {json} Post not found
   HTTP/1.1 404 Not Found
@apiErrorExample {json} Unauthorized
   HTTP/1.1 401 Unauthorized