running prettier across the app
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import User from '../models/userModel.js';
|
||||
import User from '../models/userModel.js'
|
||||
|
||||
export const getAllUsers = async (req, res, next) => {
|
||||
const allUsers = await User.find({}).exec();
|
||||
const allUsers = await User.find({}).exec()
|
||||
res.status(200).json({
|
||||
status: 'success',
|
||||
data: allUsers
|
||||
@@ -9,39 +9,39 @@ export const getAllUsers = async (req, res, next) => {
|
||||
}
|
||||
|
||||
export const getUser = async (req, res, next) => {
|
||||
const user = await User.findById(req.params.id).exec();
|
||||
const user = await User.findById(req.params.id).exec()
|
||||
if (!user) {
|
||||
return next('No document found with that id', 404);
|
||||
return next('No document found with that id', 404)
|
||||
}
|
||||
res.status(200).json({
|
||||
status: 'success',
|
||||
data: user
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
export const createUser = async (req, res, next) => {
|
||||
User.create(req.body).then(result => {
|
||||
User.create(req.body).then((result) => {
|
||||
res.status(200).json({
|
||||
status: 'success',
|
||||
data: result
|
||||
});
|
||||
});
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
export const updateUser = async (req, res, next) => {
|
||||
User.updateOne({_id: req.params.id},{$set: req.body}).then(result => {
|
||||
User.updateOne({ _id: req.params.id }, { $set: req.body }).then((result) => {
|
||||
res.status(200).json({
|
||||
status: 'success',
|
||||
data: result
|
||||
});
|
||||
});
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
export const deleteUser = async (req, res, next) => {
|
||||
User.deleteOne({_id: req.params.id}).then(result => {
|
||||
User.deleteOne({ _id: req.params.id }).then((result) => {
|
||||
res.status(200).json({
|
||||
status: 'success',
|
||||
data: result
|
||||
});
|
||||
});
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user