<commit_before>const router = require('express').Router();
const Joi = require('joi');
const guard = require('express-jwt-permissions')();
const validator = require('express-joi-validation')({ passError: true });
const { codeGuard } = require('../middlewares/code-guard');
const am = require('../../utils/async-middleware');
const { ID_SCHEMA, RANGE_SCHEMA, joiThrough } = require('../../utils');
const { MemberSchema } = require('../models/schemas');
const memberController = require('../controllers/member-controller');

router.get(
  '/',
  guard.check('member:read'),
  validator.query(RANGE_SCHEMA),
  am(memberController.getAllMembers),
);

router.post(
  '/',
  guard.check('member:write'),
  validator.body(joiThrough('member', MemberSchema.requiredKeys('firstName', 'lastName'))),
  am(codeGuard),
  am(memberController.createMember),
);

router.get(
  '/:id',
  guard.check('member:read'),
  validator.params(ID_SCHEMA),
  am(memberController.getMemberById),
);

router.put(<commit_msg>Allow empty query parameters for members (again)<commit_after>const router = require('express').Router();
const Joi = require('joi');
const guard = require('express-jwt-permissions')();
const validator = require('express-joi-validation')({ passError: true });
const { codeGuard } = require('../middlewares/code-guard');
const am = require('../../utils/async-middleware');
const { ID_SCHEMA, RANGE_SCHEMA, joiThrough } = require('../../utils');
const { MemberSchema } = require('../models/schemas');
const memberController = require('../controllers/member-controller');

router.get(
  '/',
  guard.check('member:read'),
  validator.query(RANGE_SCHEMA.optionalKeys('startAt', 'endAt')),
  am(memberController.getAllMembers),
);

router.post(
  '/',
  guard.check('member:write'),
  validator.body(joiThrough('member', MemberSchema.requiredKeys('firstName', 'lastName'))),
  am(codeGuard),
  am(memberController.createMember),
);

router.get(
  '/:id',
  guard.check('member:read'),
  validator.params(ID_SCHEMA),
  am(memberController.getMemberById),
);

router.put(
{'fraction_non_alphanumeric': 0.1941747572815534, 'fraction_numerical': 0.0, 'mean_word_length': 5.757377049180328, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2334412', 'n_tokens_mistral': 658, 'n_tokens_neox': 651, 'n_words': 102}