<commit_before>const User = require('../db/models/userModel');
const Post = require('../db/models/postModel');
const db = require('../db/db.js');

db.sync();

module.exports = {
  posts: {
    get: (req, res) => {
    //might need to pass in parameters in findall	
      Post.findAll()
    //example of findAll parameter
    //findAll({where : {username : req.body.username}})
      .then((message) => {
        res.json(message);
      });
    },
    post: (req, res) => {
     //check for relation between user and post and pass it in
     //as a param in findorcreate
      User.findOrCreate()
      .spread(() => {
        Post.create({
          title: req.body.title,
          content: req.body.content
        })
        .then((message) => {
          message.save();
        })
        .then(() => {
          res.sendStatus(201);
        });
      });
    }
  },
  users: {
    getOne: (username) => {
      User.findOne({where: {username: username}});<commit_msg>(fix) Add return statement to controller.users.getOne<commit_after>const User = require('../db/models/userModel');
const Post = require('../db/models/postModel');
const db = require('../db/db.js');

db.sync();

module.exports = {
  posts: {
    get: (req, res) => {
    //might need to pass in parameters in findall	
      Post.findAll()
    //example of findAll parameter
    //findAll({where : {username : req.body.username}})
      .then((message) => {
        res.json(message);
      });
    },
    post: (req, res) => {
     //check for relation between user and post and pass it in
     //as a param in findorcreate
      User.findOrCreate()
      .spread(() => {
        Post.create({
          title: req.body.title,
          content: req.body.content
        })
        .then((message) => {
          message.save();
        })
        .then(() => {
          res.sendStatus(201);
        });
      });
    }
  },
  users: {
    getOne: (username) => {
      return User.findOne({where: {username: username}});
{'fraction_non_alphanumeric': 0.17343358395989975, 'fraction_numerical': 0.0030075187969924814, 'mean_word_length': 1.9658246656760772, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '7109385', 'n_tokens_mistral': 619, 'n_tokens_neox': 610, 'n_words': 143}