mirror of
https://github.com/arnaucube/openEventsPlatformServer.git
synced 2026-02-06 19:26:39 +01:00
user shortDefinition
This commit is contained in:
@@ -12,7 +12,7 @@ var pageSize=config.pageSize;
|
|||||||
exports.getAllEvents = function(req, res) {
|
exports.getAllEvents = function(req, res) {
|
||||||
eventModel.find({date: {$gte: new Date()}})
|
eventModel.find({date: {$gte: new Date()}})
|
||||||
.lean()
|
.lean()
|
||||||
.populate('user', 'username')
|
.populate('user', 'username img shortDescription')
|
||||||
.sort('date')
|
.sort('date')
|
||||||
.limit(pageSize)
|
.limit(pageSize)
|
||||||
.skip(pageSize * Number(req.query.page))
|
.skip(pageSize * Number(req.query.page))
|
||||||
@@ -24,7 +24,7 @@ exports.getAllEvents = function(req, res) {
|
|||||||
exports.getEventById = function (req, res) {
|
exports.getEventById = function (req, res) {
|
||||||
eventModel.findOne({_id: req.params.eventid})
|
eventModel.findOne({_id: req.params.eventid})
|
||||||
.lean()
|
.lean()
|
||||||
.populate('user', 'username img description')
|
.populate('user', 'username img shortDescription')
|
||||||
.exec(function (err, event) {
|
.exec(function (err, event) {
|
||||||
if (err) return res.send(500, err.message);
|
if (err) return res.send(500, err.message);
|
||||||
if (!event) {
|
if (!event) {
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ exports.signup = function (req, res) {
|
|||||||
var user = new userModel({
|
var user = new userModel({
|
||||||
username: req.body.username,
|
username: req.body.username,
|
||||||
password: crypto.createHash('sha256').update(req.body.password).digest('base64'),
|
password: crypto.createHash('sha256').update(req.body.password).digest('base64'),
|
||||||
|
shortDescription: req.body.shortDescription,
|
||||||
description: req.body.description,
|
description: req.body.description,
|
||||||
email: req.body.email
|
email: req.body.email
|
||||||
});
|
});
|
||||||
@@ -103,7 +104,7 @@ exports.getAllUsers = function(req, res) {
|
|||||||
exports.getUserById = function (req, res) {
|
exports.getUserById = function (req, res) {
|
||||||
userModel.findOne({_id: req.params.userid})
|
userModel.findOne({_id: req.params.userid})
|
||||||
.lean()
|
.lean()
|
||||||
.populate('events', 'title description img date')
|
.populate('events', 'title shortDescription description img date')
|
||||||
.exec(function (err, user) {
|
.exec(function (err, user) {
|
||||||
if (err) return res.send(500, err.message);
|
if (err) return res.send(500, err.message);
|
||||||
if (!user) {
|
if (!user) {
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ var userSchema = new Schema({
|
|||||||
lastLogin: {type: Date, select: false},
|
lastLogin: {type: Date, select: false},
|
||||||
birthdate: {type: Date, select: false},
|
birthdate: {type: Date, select: false},
|
||||||
}],
|
}],
|
||||||
|
shortDescription: { type: String },
|
||||||
description: { type: String },
|
description: { type: String },
|
||||||
img: { type: String, default: "https://assets-cdn.github.com/images/modules/logos_page/GitHub-Mark.png" },
|
img: { type: String, default: "https://assets-cdn.github.com/images/modules/logos_page/GitHub-Mark.png" },
|
||||||
contact: {
|
contact: {
|
||||||
|
|||||||
Reference in New Issue
Block a user