<commit_before>'use strict';

var User = require('./user.model');
var passport = require('passport');
var config = require('../../config/environment');

/**
 * Creates a new user
 */ exports.create = function (req, res, next) {
  var newUser = new User(req.body);
  newUser.save(function(err, user) {
    if (err) return next(err);
    res.json(user);
  });
};

/**
 * Get a single user
 */
exports.show = function (req, res, next) {
  User.findOne({token: req.headers.token}, function (err, user) {
    if (err) return next(err);
    if (!user) return res.send(404, "No user found");
    res.json(user);
  });
};

/**
 * Update start_date
 */
exports.update = function (req, res, next) {
  User.findOne({token: req.headers.token}, function (err, user) {
    if (err) return next(err);
    if (!user) return res.send(404, "No user found");
    user.start_date = req.body.start_date;
    user.save(function(err, user) {
      res.json(user);
    });
  });
};
<commit_msg>add checker for start date<commit_after>'use strict';

var User = require('./user.model');
var passport = require('passport');
var config = require('../../config/environment');

/**
 * Creates a new user
 */ exports.create = function (req, res, next) {
  var newUser = new User(req.body);
  newUser.save(function(err, user) {
    if (err) return next(err);
    res.json(user);
  });
};

/**
 * Get a single user
 */
exports.show = function (req, res, next) {
  User.findOne({token: req.headers.token}, function (err, user) {
    if (err) return next(err);
    if (!user) return res.send(404, "No user found");
    res.json(user);
  });
};

/**
 * Update start_date
 */
exports.update = function (req, res, next) {
  User.findOne({token: req.headers.token}, function (err, user) {
    if (err) return next(err);
    if (!user) return res.send(404, "No user found");
    if (!req.body.start_date) return res.send(422, "Please provide a start date");
    user.start_date = req.body.start_date;
    user.save(function(err, user) {
      res.json(user);
    });
  });
};

{'fraction_non_alphanumeric': 0.18664047151277013, 'fraction_numerical': 0.0073673870333988214, 'mean_word_length': 3.3806451612903228, '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': '1192708', 'n_tokens_mistral': 700, 'n_tokens_neox': 687, 'n_words': 183}