<commit_before>"use strict";

var express = require('express');
var Investigation = require('../schemas/investigation.js');
var Project = require('../schemas/project.js');

var app = express();

app.get('/investigations/:id', function (req, res, next) {
  // Check user can access this investigation

  Investigation.findById(req.params.id).exec().then(function (investigation) {
    if (!investigation) {
      res.send(404);
    }
    res.json({
      "investigation": investigation
    });
  }, next);
});

app.put('/investigations/:id', function (req, res, next) {
  Investigation.findById(req.params.id).exec().then(function (investigation) {
    investigation.name = req.body.project.name;
    investigation.save();

    res.json({
      "investigation": investigation
    });
  }, next);
});
<commit_msg>Return all investigations<commit_after>"use strict";

var express = require('express');
var Investigation = require('../schemas/investigation.js');
var Project = require('../schemas/project.js');

var app = express();

app.get('/investigations/:id', function (req, res, next) {
  // Check user can access this investigation

  Investigation.findById(req.params.id).exec().then(function (investigation) {
    if (!investigation) {
      res.send(404);
    }
    res.json({
      "investigation": investigation
    });
  }, next);
});

app.get('/investigations', function(req, res, next){
  Investigation.find().exec().then(function(investigations) {
    res.json({
      investigations: investigations
    })
  })
});

app.put('/investigations/:id', function (req, res, next) {
  Investigation.findById(req.params.id).exec().then(function (investigation) {
    investigation.name = req.body.project.name;
    investigation.save();

    res.json({
      "investigation": investigation
    });
  }, next);
});

{'fraction_non_alphanumeric': 0.17546754675467546, 'fraction_numerical': 0.0033003300330033004, 'mean_word_length': 3.8377659574468086, 'pattern_counts': {'":': 4, '<': 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': '5613582', 'n_tokens_mistral': 571, 'n_tokens_neox': 545, 'n_words': 106}