import errorConstants from '../constants/errorConstants';

const paginationQueryError = (request, response, next) => {
  let { limit, offset } = request.query;
  const isPaginationRequired = limit || offset;
  if (isPaginationRequired) {
    if (Number.isNaN(Number(limit)) || Number.isNaN(Number(offset))) {
      return response
        .status(406)
        .json({ error: errorConstants.paginationQueryError });
    }
    offset = !offset ? 0 : offset;
    limit = Number.parseInt(limit, 10);
    offset = Number.parseInt(offset, 10);
    response.locals.paginationQueryStrings = { limit, offset };
  }
  next();
};
export default paginationQueryError;

@@ -201,16 +201,49 @@
 offset;%0A
+  offset = !offset ? 0 : offset;%0A
   if (is

fix limit and offset issue