Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
aelassas committed Dec 3, 2023
1 parent e680f65 commit a33c6f7
Show file tree
Hide file tree
Showing 13 changed files with 611 additions and 608 deletions.
341 changes: 166 additions & 175 deletions api/package-lock.json

Large diffs are not rendered by default.

26 changes: 13 additions & 13 deletions api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@
"author": "",
"license": "ISC",
"dependencies": {
"@babel/cli": "^7.23.0",
"@babel/preset-env": "^7.23.3",
"@babel/cli": "^7.23.4",
"@babel/preset-env": "^7.23.5",
"@types/bcrypt": "^5.0.2",
"@types/compression": "^1.7.5",
"@types/cookie-parser": "^1.4.6",
"@types/cors": "^2.8.16",
"@types/cors": "^2.8.17",
"@types/express": "^4.17.21",
"@types/jsonwebtoken": "^9.0.5",
"@types/multer": "^1.4.10",
"@types/node": "^20.9.1",
"@types/multer": "^1.4.11",
"@types/node": "^20.10.2",
"@types/nodemailer": "^6.4.14",
"@types/uuid": "^9.0.7",
"@types/validator": "^13.11.6",
"@types/validator": "^13.11.7",
"babel-plugin-add-import-extension": "^1.6.0",
"bcrypt": "^5.1.1",
"bookcars-types": "file:../packages/bookcars-types",
Expand All @@ -41,23 +41,23 @@
"helmet": "^7.1.0",
"jsonwebtoken": "^9.0.2",
"localized-strings": "^0.2.4",
"mongoose": "^8.0.1",
"mongoose": "^8.0.2",
"multer": "^1.4.5-lts.1",
"nocache": "^4.0.0",
"nodemailer": "^6.9.7",
"rimraf": "^5.0.5",
"typescript": "^5.2.2",
"typescript": "^5.3.2",
"uuid": "^9.0.1",
"validator": "^13.11.0"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^6.11.0",
"@typescript-eslint/parser": "^6.11.0",
"eslint": "^8.54.0",
"@typescript-eslint/eslint-plugin": "^6.13.1",
"@typescript-eslint/parser": "^6.13.1",
"eslint": "^8.55.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-plugin-import": "^2.29.0",
"nodemon": "^3.0.1",
"npm-check-updates": "^16.14.6",
"nodemon": "^3.0.2",
"npm-check-updates": "^16.14.11",
"ts-node": "^10.9.1"
}
}
4 changes: 3 additions & 1 deletion api/src/controllers/carController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,10 @@ export async function deleteCar(req: Request, res: Response) {
const { id } = req.params

try {
const car = await Car.findByIdAndDelete(id)
const car = await Car.findById(id)
if (car) {
await Car.deleteOne({ _id: id })

if (car.image) {
const image = path.join(env.CDN_CARS, car.image)
if (await Helper.exists(image)) {
Expand Down
3 changes: 2 additions & 1 deletion api/src/controllers/locationController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,13 @@ export async function deleteLocation(req: Request, res: Response) {
const { id } = req.params

try {
const location = await Location.findByIdAndDelete(id)
const location = await Location.findById(id)
if (!location) {
const msg = `[location.delete] Location ${id} not found`
console.log(msg)
return res.status(204).send(msg)
}
await Location.deleteOne({ _id: id })
await LocationValue.deleteMany({ _id: { $in: location.values } })
return res.sendStatus(200)
} catch (err) {
Expand Down
4 changes: 3 additions & 1 deletion api/src/controllers/supplierController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,10 @@ export async function deleteSupplier(req: Request, res: Response) {
const { id } = req.params

try {
const supplier = await User.findByIdAndDelete(id)
const supplier = await User.findById(id)
if (supplier) {
await User.deleteOne({ _id: id })

if (supplier.avatar) {
const avatar = path.join(env.CDN_USERS, supplier.avatar)
if (await Helper.exists(avatar)) {
Expand Down
4 changes: 3 additions & 1 deletion api/src/controllers/userController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1201,9 +1201,11 @@ export async function deleteUsers(req: Request, res: Response) {
const ids: mongoose.Types.ObjectId[] = body.map((id: string) => new mongoose.Types.ObjectId(id))

for (const id of ids) {
const user = await User.findByIdAndDelete(id)
const user = await User.findById(id)

if (user) {
await User.deleteOne({ _id: id })

if (user.avatar) {
const avatar = path.join(env.CDN_USERS, user.avatar)
if (await Helper.exists(avatar)) {
Expand Down
Loading

0 comments on commit a33c6f7

Please sign in to comment.