<commit_before>const express = require('express');
const router = express.Router();
const Patch = require('../models/patch');
const bodyParser = require('body-parser').json();

router
  .get('/', (req, res, next) => {
      const query = {};
      if(req.query.userId) query.userId = req.query.userId;

      Patch.find(query)
          .populate('userId', 'username')
          .lean()
          .then(patchs => res.send(patchs))
          .catch(next);
  })
  .get('/:id', (req, res, next) => {
      Patch.findById(req.params.id)
          .then(patch => res.send(patch))
          .catch(next);
  })
  .post('/', bodyParser, (req, res, next) => {
      new Patch(req.body).save()
          .then(newPatch => res.send(newPatch))
         .catch(next);
  })<commit_msg>fixing patchs.js merge conflict<commit_after>const express = require('express');
const router = express.Router();
const Patch = require('../models/patch');
const bodyParser = require('body-parser').json();

router
  .get('/', (req, res, next) => {
      const query = {};
      if(req.query.userId) query.userId = req.query.userId;

      Patch.find(query)
          .populate('userId', 'username')
          .lean()
          .then(patchs => res.send(patchs))
          .catch(next);
  })
  .get('/:id', (req, res, next) => {
      Patch.findById(req.params.id)
          .then(patch => res.send(patch))
          .catch(next);
  })
  .post('/', bodyParser, (req, res, next) => {
      new Patch(req.body).save()
          .then(newPatch => res.send(newPatch))
          .catch(next);
  })
{'fraction_non_alphanumeric': 0.19923126201153107, 'fraction_numerical': 0.0, 'mean_word_length': 2.4557522123893807, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '5246058', 'n_tokens_mistral': 512, 'n_tokens_neox': 511, 'n_words': 97}