<commit_before>const projects = require('../../db/model/projects');
const projectDelete = require('../../db/model/project-delete');
const parse = require('co-body');
const status = require('http-status');
const ra = require('../resource-access');
const Router = require('koa-router');

const samples = require('./samples');
const files = require('./files');
const directories = require('./directories');
const processes = require('./processes');
const shares = require('./shares');
const experiments = require('./experiments');

function* create(next){
    let user = this.reqctx.user;
    let attrs = yield parse(this);
    let rv = yield projects.createProject(user,attrs);
    if (rv.error) {
        this.status = status.BAD_REQUEST;
        this.body = rv;
    } else {
        this.body = rv.val;
    }
    yield next;
}

function* all(next) {
    let user = this.reqctx.user;
    if (this.query.simple) {
        this.body = yield projects.forUserSimple(user);
    } else {
        this.body = yield projects.forUser(user);
    }
    yield next;
}

function* getProject(next) {
    let rv = yield projects.getProject(this.params.project_id);
    if (rv.error) {
        this.status = status.BAD_REQUEST;
        this.body = rv;
    } else {
        this.body = rv.val;
    }
    yield next;
}

function* deleteProject(next) {
    yield projectDelete.quickProjectDelete(this.params.project_id);
    this.body = this.params.project_id
    yield next;
}

function* deleteProjectFull(next) {
    let options = {
        dryRun: false
    };
    let rv = yield projectDelete.deleteProject(this.params.project_id,options);
    if (rv.error) {
        this.status = status.BAD_REQUEST;
        this.body = rv;
    } else {
        this.body = rv.val;
    }
    yield next;
}

function* update(next) {
    let attrs = yield parse(this);
    this.body = yield projects.update(this.params.project_id, attrs);
    yield next;
}

function* getUserAccessForProject(next) {
    this.body = yield projects.getUserAccessForProject(this.params.project_id);
    yield next;
}
<commit_msg>delete project returns id as object<commit_after>const projects = require('../../db/model/projects');
const projectDelete = require('../../db/model/project-delete');
const parse = require('co-body');
const status = require('http-status');
const ra = require('../resource-access');
const Router = require('koa-router');

const samples = require('./samples');
const files = require('./files');
const directories = require('./directories');
const processes = require('./processes');
const shares = require('./shares');
const experiments = require('./experiments');

function* create(next){
    let user = this.reqctx.user;
    let attrs = yield parse(this);
    let rv = yield projects.createProject(user,attrs);
    if (rv.error) {
        this.status = status.BAD_REQUEST;
        this.body = rv;
    } else {
        this.body = rv.val;
    }
    yield next;
}

function* all(next) {
    let user = this.reqctx.user;
    if (this.query.simple) {
        this.body = yield projects.forUserSimple(user);
    } else {
        this.body = yield projects.forUser(user);
    }
    yield next;
}

function* getProject(next) {
    let rv = yield projects.getProject(this.params.project_id);
    if (rv.error) {
        this.status = status.BAD_REQUEST;
        this.body = rv;
    } else {
        this.body = rv.val;
    }
    yield next;
}

function* deleteProject(next) {
    yield projectDelete.quickProjectDelete(this.params.project_id);
    this.body = {project_id: this.params.project_id}
    yield next;
}

function* deleteProjectFull(next) {
    let options = {
        dryRun: false
    };
    let rv = yield projectDelete.deleteProject(this.params.project_id,options);
    if (rv.error) {
        this.status = status.BAD_REQUEST;
        this.body = rv;
    } else {
        this.body = rv.val;
    }
    yield next;
}

function* update(next) {
    let attrs = yield parse(this);
    this.body = yield projects.update(this.params.project_id, attrs);
    yield next;
}

function* getUserAccessForProject(next) {
    this.body = yield projects.getUserAccessForProject(this.params.project_id);
    yield next;
}

{'fraction_non_alphanumeric': 0.14200477326968974, 'fraction_numerical': 0.0, 'mean_word_length': 2.9800569800569803, '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': '3309352', 'n_tokens_mistral': 1276, 'n_tokens_neox': 1279, 'n_words': 288}