(req, res)
| 277 | |
| 278 | // Get user by ID |
| 279 | const getUserById = async (req, res) => { |
| 280 | try { |
| 281 | const userId = req.params.id; |
| 282 | const user = await User.findById(userId).populate("product_id"); |
| 283 | |
| 284 | if (!user) { |
| 285 | return res.status(404).json({ message: "User not found" }); |
| 286 | } |
| 287 | res.status(200).json({ message: "User found", user }); |
| 288 | } catch (error) { |
| 289 | console.error(error); |
| 290 | res.status(500).json({ message: "Internal Server Error" }); |
| 291 | } |
| 292 | }; |
| 293 | |
| 294 | // Update user |
| 295 | const updateUser = async (req, res) => { |
nothing calls this directly
no outgoing calls
no test coverage detected