Skip to content

Commit

Permalink
fix: updated user list api
Browse files Browse the repository at this point in the history
  • Loading branch information
Rakshitha-D committed Jan 7, 2025
1 parent fec9c37 commit dd61126
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 dd61126

Please sign in to comment.