xxxxxxxxxx
const editUser = async (req, res) => {
const {params: {id: userid}} = req
if(req.body.pin){
// TODO: destructure req.body into pin, bank and account number
// const { pin, bank, accountNumber } = req.body;
}
const updateStatus = await User.updateOne({_id: userid}, req.body, {
runValidators: true,
})
if (updateStatus.nModified == 0) {
throw new NotFoundError(`No user with id of ${userid}`);
}
res.status(StatusCodes.OK).json({msg:'Change has been Successfully made'})
}