{"size": 622, "ext": "js", "max_stars_repo_path": "db/validations.js", "max_stars_repo_name": "amZotti/queryMetric", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "db/validations.js", "max_issues_repo_name": "amZotti/queryMetric", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "db/validations.js", "max_forks_repo_name": "amZotti/queryMetric", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 24.88, "max_line_length": 80, "alphanum_fraction": 0.6559485531}
var helper = require('./helpers.js');

validateFilter = function(filter) {
  return filter === 'start_date' || filter === 'end_date' || filter === 'value';
};

validateDate = function(date) {
  return helper.isInt(date);
};

validateAggregate = function(aggregate) {
  return aggregate === 'sum' || aggregate === 'count' || aggregate === 'avg';
};

validateRange = function(range) {
  return range === 'after' || range === 'before';
};

exports.validateInput = function(req) {
  return validateFilter(req.filter) &&
    validateFilter(req.aggregateTarget) &&
    validateRange(req.range) &&
    validateDate(req.date);
};
