quick fix
This commit is contained in:
parent
a4c2ffa119
commit
0d26b512e3
@ -50,14 +50,14 @@ exports.createCar = async (req, res) => {
|
||||
await userCollection.save();
|
||||
}
|
||||
|
||||
let user = await user.findById(userId);
|
||||
if (!user) {
|
||||
let founduser = await user.findById(userId);
|
||||
if (!founduser) {
|
||||
return res.status(404).json({ message: "User not found" });
|
||||
}
|
||||
|
||||
// update number of cars in the collection
|
||||
user.number_of_cars = userCollection.cars.length;
|
||||
await user.save();
|
||||
founduser.number_of_cars = userCollection.cars.length;
|
||||
await founduser.save();
|
||||
|
||||
// 7) Return success
|
||||
return res.status(201).json({
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user