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 6121fdc commit 67601fe
Show file tree
Hide file tree
Showing 13 changed files with 611 additions and 607 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,29 +15,29 @@
"author": "",
"license": "ISC",
"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"
},
"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",
"compression": "^1.7.4",
Expand All @@ -50,14 +50,14 @@
"helmet": "^7.1.0",
"jsonwebtoken": "^9.0.2",
"localized-strings": "^0.2.4",
"mongoose": "^8.0.1",
"mongoose": "^8.0.2",
"movinin-helper": "file:../packages/movinin-helper",
"movinin-types": "file:../packages/movinin-types",
"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"
}
Expand Down
5 changes: 4 additions & 1 deletion api/src/controllers/agencyController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,11 @@ export async function deleteAgency(req: Request, res: Response) {
const { id } = req.params

try {
const agency = await User.findByIdAndDelete(id)
const agency = await User.findById(id)

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

if (agency.avatar) {
const avatar = path.join(env.CDN_USERS, agency.avatar)
if (await Helper.exists(avatar)) {
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 @@ -126,12 +126,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/propertyController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,10 @@ export async function deleteProperty(req: Request, res: Response) {
const { id } = req.params

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

if (property.image) {
const image = path.join(env.CDN_PROPERTIES, property.image)
if (await Helper.exists(image)) {
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 @@ -1197,9 +1197,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 67601fe

Please sign in to comment.