<commit_before>var models = require('../models')
var Boom = require('boom')
var Joi = require('joi')


module.exports = [{
    method: 'GET',
    path: '/api/users/{userId}/todos',
    config: {
        tags: ['api'],
        validate: {
            params: {
                userId: Joi.number().integer().required()
            }
        },
        handler: function(request, reply) {
            console.log(1)
            models.Todo.findAll({
                where: {
                    userId: request.params.userId
                },
                raw: true
            })
            .then(reply)
            .catch(reply)
        }
    }
}, {
    method: 'POST',
    path: '/api/users/{userId}/todos',
    config: {
        tags: ['api'],
        validate: {
            params: {
                userId: Joi.number().integer().required()
            },
            payload: {
                text: Joi.string().min(1).max(1000).required(),
                done: Joi.boolean()
            }
        },
        handler: function(request, reply) {
            var todo = request.payload
            todo.UserId = parseInt(request.params.userId, 10)
            models.Todo.create(todo)
            .then(reply)
            .catch(reply)
        }
    }
}, {
    method: 'PUT',
    path: '/api/users/{userId}/todos/{todoId}',
    config: {<commit_msg>Debugging heroku<commit_after>var models = require('../models')
var Boom = require('boom')
var Joi = require('joi')


module.exports = [{
    method: 'GET',
    path: '/api/users/{userId}/todos',
    config: {
        tags: ['api'],
        validate: {
            params: {
                userId: Joi.number().integer().required()
            }
        },
        handler: function(request, reply) {
            console.log(1)
            models.Todo.findAll({
                where: {
                    userId: request.params.userId
                },
                raw: true
            })
            .then(reply)
            .catch((err) => {
                console.dir(err)
                reply(err)
            })
        }
    }
}, {
    method: 'POST',
    path: '/api/users/{userId}/todos',
    config: {
        tags: ['api'],
        validate: {
            params: {
                userId: Joi.number().integer().required()
            },
            payload: {
                text: Joi.string().min(1).max(1000).required(),
                done: Joi.boolean()
            }
        },
        handler: function(request, reply) {
            var todo = request.payload
            todo.UserId = parseInt(request.params.userId, 10)
            models.Todo.create(todo)
            .then(reply)
            .catch(reply)
        }
    }
}, {
    method: 'PUT',
    path: '/api/users/{userId}/todos/{todoId}',
    config: {
{'fraction_non_alphanumeric': 0.15096359743040685, 'fraction_numerical': 0.005710206995003569, 'mean_word_length': 1.2714748784440844, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '4856489', 'n_tokens_mistral': 819, 'n_tokens_neox': 812, 'n_words': 135}