From baa419d7540e34491c6cdeda211d58943a3612a4 Mon Sep 17 00:00:00 2001 From: Kaustubh Date: Sat, 20 Mar 2021 14:52:41 +0530 Subject: [PATCH] --Solved: 212 (#223) --- app/controllers/user.js | 8 +++++--- app/models/Organisation.js | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/controllers/user.js b/app/controllers/user.js index b26fdc9..26416e0 100644 --- a/app/controllers/user.js +++ b/app/controllers/user.js @@ -461,11 +461,13 @@ module.exports = { // GET OVERALL PERSONAL OVERVIEW getPersonalOverview: async (req, res, next) => { - const userId = req.user._id + const userId = req.user.id const personalOverview = {} try { - personalOverview.projects = await Projects.find({ createdBy: userId }).estimatedDocumentCount() - personalOverview.events = await Events.find({ createdBy: userId }).estimatedDocumentCount() + let projects = await Projects.find({ createdBy: userId }) + let events = await Events.find({ createdBy: userId }) + personalOverview.projects = projects.length; + personalOverview.events = events.length; return res.status(HttpStatus.OK).json({ personalOverview }) } catch (error) { HANDLER.handleError(req, error) diff --git a/app/models/Organisation.js b/app/models/Organisation.js index e370687..bfc7271 100644 --- a/app/models/Organisation.js +++ b/app/models/Organisation.js @@ -27,7 +27,7 @@ const orgSchema = new Schema({ if (validator.isEmpty(shortDescription)) { throw new Error('Short description is required!') } - if (!validator.isLength(shortDescription, { min: 10 })) { + if (!validator.isLength(shortDescription, { min: 5 })) { throw new Error('Short description should be min 5 characters long!') } }