const docHelper = {
  checkDocDetails: (req) => {
    const document = req.body;
    if (!(document.title && document.content && document.access)) {
      return false;
    }
    return true;
  },
  queryBuilder: (reqQuery) => {
    const dbQuery = {
      order: [['createdAt', 'DESC']]
    };

    const queries = Object.keys(reqQuery);

    if (queries.indexOf('offset') > -1) {
      dbQuery.offset = reqQuery.offset;
    }
    if (queries.indexOf('limit') > -1) {
      dbQuery.limit = reqQuery.limit;
    }
    if (queries.indexOf('date') > -1) {
      const nextDate = new Date(reqQuery.date);

      dbQuery.where = {
        createdAt: {
          $lt: new Date(new Date(nextDate.setDate(nextDate.getDate() + 1))),
          $gt: new Date(new Date(reqQuery.date) - 1)
        }
      };
    }

    return dbQuery;
  }
};

module.exports = docHelper;

@@ -137,16 +137,119 @@
 t.access
+ &&%0A      (document.access === 'public' %7C%7C document.access === 'private' %7C%7C document.access === 'role')
 )) %7B%0A   

Check if access field of document has a correct value