Skip to content

Commit

Permalink
Adding user standarization 1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
MOHAMMED1MEDHAT committed Sep 10, 2023
1 parent c6a82e5 commit 4b9760c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/controllers/auth.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ exports.signup = catchAsyncError(async (req, res, next) => {
);

const userObj =
userType.toLowerCase() === 'mentor'
type.toLowerCase() === 'mentor'
? standarizeMentor(newUser)
: standarizeUser(newUser);

Expand Down
12 changes: 6 additions & 6 deletions src/controllers/controllerUtils/handlerFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ exports.getAll = Model => {

const docObj =
`${Model}`.toLowerCase() === 'mentor'
? doc.map(mentor => standarizeMentor(mentor))
: doc.map(user => standarizeUser(user));
? doc.map(d => standarizeMentor(d))
: doc.map(d => standarizeUser(d));

res.status(res.locals.statusCode || res.locals.statusCode || 200).json({
status: 'success',
Expand All @@ -30,8 +30,8 @@ exports.activateOne = Model => {

const docObj =
`${Model}`.toLowerCase() === 'mentor'
? standarizeMentor(mentor)
: standarizeUser(user);
? standarizeMentor(doc)
: standarizeUser(doc);

res.status(res.locals.statusCode || 200).json({
status: 'success',
Expand Down Expand Up @@ -61,8 +61,8 @@ exports.getOne = Model => {

const docObj =
`${Model}`.toLowerCase() === 'mentor'
? standarizeMentor(mentor)
: standarizeUser(user);
? standarizeMentor(doc)
: standarizeUser(doc);

res.status(res.locals.statusCode || 200).json({
status: 'success',
Expand Down

0 comments on commit 4b9760c

Please sign in to comment.