mirror of
https://github.com/arnaucube/thoughts.git
synced 2026-02-06 19:26:47 +01:00
tokens fully implemented, get all thoughts from user by user id implemented
This commit is contained in:
@@ -22,6 +22,26 @@ exports.findById = function(req, res) {
|
||||
});
|
||||
};
|
||||
|
||||
exports.findAllThoughtsFromUsername = function(req, res) {
|
||||
thoughtModel.find({
|
||||
authorname: req.params.userid
|
||||
}, function(err, thoughts) {
|
||||
|
||||
if (err) throw err;
|
||||
|
||||
if (!thoughts) {
|
||||
res.json({ success: false, message: 'no thoughts for user' });
|
||||
} else if (thoughts) {
|
||||
console.log(thoughts);
|
||||
// return the information including token as JSON
|
||||
res.jsonp(thoughts);
|
||||
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
//POST - Insert a new TVShow in the DB
|
||||
exports.addThought = function(req, res) {
|
||||
console.log('POST new thought, content: ' + req.body.content);
|
||||
|
||||
@@ -30,6 +30,7 @@ exports.findById = function(req, res) {
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
//POST - Insert a new TVShow in the DB
|
||||
exports.addUser = function(req, res) {
|
||||
console.log('POST new user, name: ' + req.body.username);
|
||||
|
||||
Reference in New Issue
Block a user