<commit_before>var User = require('./../../database/models/user_schema.js');
var db = require('./../../database/config.js');

var exportObj = {};

exportObj.addLink = function(linkHash, senderID, receiverID) {
  new User({
    linkHash: linkHash,
    senderID: senderID,
    receiverIDArray: receiverID
  }).save(function(err, addedUser) {
    if(err) {
      console.log('error trying to save user to DB:', err);
    } else {
      console.log('addedUser:', addedUser);
    }
  });
};

exportObj.addReceiverToSender = function(senderID, receiverID) {
  User.findOneAndUpdate(
    {senderID: senderID},
    {$push: {receiverIDArray: receiverID}},
    {safe: true, upsert: true},
    function(err, model) {
      console.log(err);
    }
  );
};

exportObj.deleteLink = function(senderID) {
  User.find({senderID: senderID}).remove(function(err) {
    if (err) {
      console.log('could not delete', senderID, ':', err);
    } else {
      console.log('deleted', senderID);
    }
  }).exec();
};

exportObj.getSenderID = function(linkHash) {
  User.findOne({linkHash: linkHash}, function(err, user) {
    if (err) {
      console.log('could not get user', user, ':', err);
    } else {<commit_msg>[fix] matched variable names in database_queries.js<commit_after>var User = require('./../../database/models/user_schema.js');
var db = require('./../../database/config.js');

var exportObj = {};

exportObj.addLink = function(linkHash, senderID) {
  return new User({
    linkHash: linkHash,
    senderID: senderID,
    receiverIDArray: []
  }).save(function(err, addedUser) {
    if(err) {
      console.log('error trying to save user to DB:', err);
    } else {
      console.log('addedUser:', addedUser);
    }
  });
};

exportObj.addReceiverToSender = function(linkHash, receiverID) {
  console.log('addRECEIVERToSEnder firing event');
  return User.findOneAndUpdate(
    {linkHash: linkHash},
    {$push: {receiverIDArray: receiverID}},
    {safe: true, upsert: true}
  );
};

exportObj.deleteLink = function(senderID) {
  User.find({senderID: senderID}).remove(function(err) {
    if (err) {
      console.log('could not delete', senderID, ':', err);
    } else {
      console.log('deleted', senderID);
    }
  }).exec();
};

exportObj.getSenderId = function(linkHash) {
  return User.findOne({linkHash: linkHash}, function(err, user) {
    if (err) {
      console.log('could not get user', user, ':', err);
    } else {
{'fraction_non_alphanumeric': 0.17244224422442245, 'fraction_numerical': 0.0, 'mean_word_length': 3.4990723562152133, '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': '3509904', 'n_tokens_mistral': 794, 'n_tokens_neox': 793, 'n_words': 166}