(req, res)
| 46 | }; |
| 47 | |
| 48 | const updateUser = async (req, res) => { |
| 49 | const { username, email, fullname, address, city, state, country } = req.body; |
| 50 | if (+req.params.id === req.user.id || req.user.roles.includes("admin")) { |
| 51 | try { |
| 52 | const results = await userService.updateUser({ |
| 53 | username, |
| 54 | email, |
| 55 | fullname, |
| 56 | address, |
| 57 | city, |
| 58 | state, |
| 59 | country, |
| 60 | id: req.params.id, |
| 61 | }); |
| 62 | return res.status(201).json(results); |
| 63 | } catch (error) { |
| 64 | throw new ErrorHandler(error.statusCode, error.message); |
| 65 | } |
| 66 | } |
| 67 | throw new ErrorHandler(401, "Unauthorized"); |
| 68 | }; |
| 69 | |
| 70 | const deleteUser = async (req, res) => { |
| 71 | const { id } = req.params; |
nothing calls this directly
no outgoing calls
no test coverage detected