(req, res)
| 25 | }; |
| 26 | |
| 27 | const getUserById = async (req, res) => { |
| 28 | const { id } = req.params; |
| 29 | if (+id === req.user.id || req.user.roles.includes("admin")) { |
| 30 | try { |
| 31 | const user = await userService.getUserById(id); |
| 32 | return res.status(200).json(user); |
| 33 | } catch (error) { |
| 34 | throw new ErrorHandler(error.statusCode, "User not found"); |
| 35 | } |
| 36 | } |
| 37 | throw new ErrorHandler(401, "Unauthorized"); |
| 38 | }; |
| 39 | |
| 40 | const getUserProfile = async (req, res) => { |
| 41 | const { id } = req.user; |
nothing calls this directly
no outgoing calls
no test coverage detected