<commit_before>var model = require('./dbModel.js');

var getUser = function (user) {
  model.User.findOne({ where: { username: user.username }})
    .then(function (match) {
      if (!match) {
        throw (new Error('User does not exist!'));
      } else {
        return match;
      }
    })
};

var addUser = function (user) {
  model.User.findOne({ where: { username: user.username } })
    .then(function (match) {
      if (match) {
        throw (new Error('Username already exists'));
      } else {
        return user;
      }
    })
    .then(function (newUser) {
      return model.User.create({ username: newUser.username, password: <PASSWORD> });
    })
};

var addItem = function (object) {
  // object will have the following format { item: { name: 'xyz' }, user: { id: 'INTEGER', name: 'abc' } }
  model.Item.findOrCreate({ where: { name: object.itemName } })
    .then(function (item) {
      return model.ItemUser.findOrCreate({ where: { item_id: item.id, used_id: object.user } });
    })
};

var getRelatedItems = function (itemList) {

};

var addCategory = function (req, res) {

};

var getCategory = function (req, res) {

};

var getAllCategories = function (req, res) {
<commit_msg>[refactor] comment out an incomplete line of code in dbController to get sever running<commit_after>var model = require('./dbModel.js');

var getUser = function (user) {
  model.User.findOne({ where: { username: user.username }})
    .then(function (match) {
      if (!match) {
        throw (new Error('User does not exist!'));
      } else {
        return match;
      }
    })
};

var addUser = function (user) {
  model.User.findOne({ where: { username: user.username } })
    .then(function (match) {
      if (match) {
        throw (new Error('Username already exists'));
      } else {
        return user;
      }
    })
    .then(function (newUser) {
      return model.User.create({ username: newUser.username, password: <PASSWORD> });
    })
};

var addItem = function (object) {
  // object will have the following format { item: { name: 'xyz' }, user: { id: 'INTEGER', name: 'abc' } }
  model.Item.findOrCreate({ where: { name: object.itemName } })
    .then(function (item) {
      return model.ItemUser.findOrCreate({ where: { item_id: item.id, used_id: object.user } });
    })
};

var getRelatedItems = function (itemList) {
  
};

var addCategory = function (req, res) {

};

var getCategory = function (req, res) {

};

var getAllCategories = function (req, res) {

{'fraction_non_alphanumeric': 0.1568627450980392, 'fraction_numerical': 0.0, 'mean_word_length': 2.8940809968847354, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '6168939', 'n_tokens_mistral': 798, 'n_tokens_neox': 789, 'n_words': 217}