Skip to content

Commit

Permalink
Merge pull request #158 from Sanketika-Obsrv/userList
Browse files Browse the repository at this point in the history
fix: updated user list api
  • Loading branch information
HarishGangula authored Jan 7, 2025
2 parents fec9c37 + dd61126 commit 793a9cf
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/main/controllers/user_list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ export default {
try {
const user = _.get(request, ['body', 'request']);
const result = await userService.findAll(user);
const responseData = { data: result, count: _.size(result) };

const usersList = result.map((user: any) => {
const { password, provider, mobile_number, ...sanitizedUser } = user;
return sanitizedUser;
});

const responseData = { data: usersList, count: _.size(usersList) };
response.status(200).json(transform({ id: request.body.id, result: responseData }));
} catch (error) {
if (error === 'user_not_found') {
Expand All @@ -21,4 +27,4 @@ export default {
}
}
},
};
};

0 comments on commit 793a9cf

Please sign in to comment.