<commit_before>var mongoose = require('mongoose');
var Wallet = require('../../models/wallet.js').Wallet;
exports.getWalletByID = function(req, res) {
	return Wallet.findById(req.params.id, function(err, wallet) {
		if (!err) {
			res.send(wallet);
		}
		else {
			console.log(err);
		}
	});
}

exports.getWalletByUser = function(req, res) {
	Wallet.find({ 'userID' : req.session.userId},
		function(err, wallet) {
			if (!err) {
				res.send({"wallet":wallet});
			}
			else {
				console.log(err);
			}
		});
}

exports.updateWallet = function(req, res) {
	Wallet.findByIdAndUpdate(req.params.id,
			{
				green: req.body.wallet.green,
				purple: req.body.wallet.purple,
				red: req.body.wallet.red,
				blue: req.body.wallet.blue
			},
			function(err, wallet) {
				if (!err) {
					res.send(200);
				}
				else {
					console.log(err);
					res.send(500);
				}
			});
}<commit_msg>Updated wallet PUT method to conform to Ember Data expectation<commit_after>var mongoose = require('mongoose');
var Wallet = require('../../models/wallet.js').Wallet;
exports.getWalletByID = function(req, res) {
	return Wallet.findById(req.params.id, function(err, wallet) {
		if (!err) {
			res.send(wallet);
		}
		else {
			console.log(err);
		}
	});
}

exports.getWalletByUser = function(req, res) {
	Wallet.find({ 'userID' : req.session.userId},
		function(err, wallet) {
			if (!err) {
				res.send({"wallet":wallet});
			}
			else {
				console.log(err);
			}
		});
}

exports.updateWallet = function(req, res) {
	Wallet.findByIdAndUpdate(req.params.id,
			{
				green: req.body.wallet.green,
				purple: req.body.wallet.purple,
				red: req.body.wallet.red,
				blue: req.body.wallet.blue
			},
			function(err, wallet) {
				if (!err) {
					res.send(200, { wallet: wallet });
				}
				else {
					console.log(err);
					res.send(500);
				}
			});
}
{'fraction_non_alphanumeric': 0.17739318550567876, 'fraction_numerical': 0.006489994591671174, 'mean_word_length': 2.9870689655172415, 'pattern_counts': {'":': 2, '<': 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': '5413511', 'n_tokens_mistral': 821, 'n_tokens_neox': 709, 'n_words': 113}