arnaucube
arnaucube/openEventsPlatformServerPublic Self-hosted repository
user shortDefinition
arnaucode idoctnef@openmailbox.org
Sun, 19 Feb 2017 21:58:22 +0100
commit

339dd3e26c1c946c3b5d305b176e4d4dcf717f65

parent

1609221d77bdf820834f9d0300c388ec02d1b3c7

3 files changed, 5 insertions(+), 3 deletions(-)

jump to
M controllers/eventController.js → controllers/eventController.js

@@ -12,7 +12,7 @@

exports.getAllEvents = function(req, res) { eventModel.find({date: {$gte: new Date()}}) .lean() - .populate('user', 'username') + .populate('user', 'username img shortDescription') .sort('date') .limit(pageSize) .skip(pageSize * Number(req.query.page))

@@ -24,7 +24,7 @@ };

exports.getEventById = function (req, res) { eventModel.findOne({_id: req.params.eventid}) .lean() - .populate('user', 'username img description') + .populate('user', 'username img shortDescription') .exec(function (err, event) { if (err) return res.send(500, err.message); if (!event) {
M controllers/userController.js → controllers/userController.js

@@ -14,6 +14,7 @@ exports.signup = function (req, res) {

var user = new userModel({ username: req.body.username, password: crypto.createHash('sha256').update(req.body.password).digest('base64'), + shortDescription: req.body.shortDescription, description: req.body.description, email: req.body.email });

@@ -103,7 +104,7 @@

exports.getUserById = function (req, res) { userModel.findOne({_id: req.params.userid}) .lean() - .populate('events', 'title description img date') + .populate('events', 'title shortDescription description img date') .exec(function (err, user) { if (err) return res.send(500, err.message); if (!user) {
M models/userModel.js → models/userModel.js

@@ -19,6 +19,7 @@ ip: {type: String, select: false},

lastLogin: {type: Date, select: false}, birthdate: {type: Date, select: false}, }], + shortDescription: { type: String }, description: { type: String }, img: { type: String, default: "https://assets-cdn.github.com/images/modules/logos_page/GitHub-Mark.png" }, contact: {