Skip to content

Commit

Permalink
Update dependencies to latest versions
Browse files Browse the repository at this point in the history
  • Loading branch information
satishbabariya committed Oct 14, 2023
1 parent e1f7e44 commit 3ecc5c7
Show file tree
Hide file tree
Showing 7 changed files with 2,335 additions and 2,024 deletions.
28 changes: 14 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@
"node": ">=8.0.0"
},
"dependencies": {
"agenda": "^4.3.0",
"argon2": "^0.28.5",
"agenda": "^5.0.0",
"argon2": "^0.31.1",
"body-parser": "^1.20.0",
"celebrate": "^15.0.1",
"cors": "^2.8.5",
"dotenv": "^16.0.3",
"express": "^4.18.1",
"express-jwt": "^6.1.1",
"helmet": "^5.0.2",
"express-jwt": "^8.4.1",
"helmet": "^7.0.0",
"joi": "^17.6.0",
"jsonwebtoken": "^8.5.1",
"mongodb": "^4.10.0",
"jsonwebtoken": "^9.0.2",
"mongodb": "^6.1.0",
"reflect-metadata": "^0.1.13",
"typedi": "^0.10.0",
"typeorm": "^0.3.10",
Expand All @@ -41,16 +41,16 @@
"devDependencies": {
"@types/cors": "^2.8.12",
"@types/express": "^4.17.13",
"@types/express-jwt": "^6.0.4",
"@types/jest": "^27.5.0",
"@types/jest": "^29.5.5",
"@types/morgan": "^1.9.3",
"@types/node": "^18.7.23",
"jest": "^27.5.1",
"nodemon": "^2.0.15",
"prettier": "^2.6.2",
"ts-jest": "^27.1.4",
"@types/node": "^20.8.6",
"chai": "^4.3.10",
"jest": "^29.7.0",
"nodemon": "^3.0.1",
"prettier": "^3.0.3",
"ts-jest": "^29.1.1",
"ts-node": "^10.7.0",
"tslint": "^6.1.3",
"typescript": "^4.8.4"
"typescript": "^5.2.2"
}
}
4 changes: 2 additions & 2 deletions src/api/middlewares/attachCurrentUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ import UserService from '../../services/users';
const attachCurrentUser = async (req, res, next) => {
try {
const userServiceInstance = Container.get(UserService);
const userRecord = await userServiceInstance.findOne(req.token.id);
const userRecord = await userServiceInstance.findOne(req.auth.id);
if (!userRecord) {
return res.sendStatus(401);
}
const currentUser = userRecord;
Reflect.deleteProperty(currentUser, 'password');
Reflect.deleteProperty(currentUser, 'salt');
req.currentUser = currentUser;
req.currentUser.os = req.token.os;
req.currentUser.os = req.auth.os;
return next();
} catch (e) {
console.log(' Error attaching user to req');
Expand Down
3 changes: 1 addition & 2 deletions src/api/middlewares/isAuth.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import jwt from 'express-jwt';
import {expressjwt as jwt} from 'express-jwt';
import config from '../../config';

/**
Expand All @@ -22,7 +22,6 @@ const getTokenFromHeader = (req) => {
const isAuth = jwt({
algorithms: ['HS256'], // This is the default algorithm used by jsonwebtoken
secret: config.jwtSecret, // The _secret_ to sign the JWTs
userProperty: 'token', // Use req.token to store the JWT
getToken: getTokenFromHeader, // How to extract the JWT from the request
});

Expand Down
3 changes: 1 addition & 2 deletions src/loaders/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ export default async (): Promise<Connection> => {
port: config.database.port,
database: config.database.database,
synchronize: false,
logging: true,
// useNewUrlParser: true,
logging: false,
entities: [User],
};

Expand Down
4 changes: 2 additions & 2 deletions src/models/User.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
CreateDateColumn,
Entity,
Index,
ObjectID,
ObjectId,
ObjectIdColumn,
UpdateDateColumn,
} from 'typeorm';
Expand All @@ -17,7 +17,7 @@ export enum Role {
@Entity()
export class User {
@ObjectIdColumn()
public id: ObjectID;
public id: ObjectId;

@Column()
public name: string;
Expand Down
2 changes: 1 addition & 1 deletion src/services/users.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Service } from 'typedi';
import { FindOneOptions, ObjectID, Repository } from 'typeorm';
import { FindOneOptions, Repository } from 'typeorm';
import { InjectRepository } from 'typeorm-typedi-extensions';
import { User } from '../models/User';

Expand Down
Loading

0 comments on commit 3ecc5c7

Please sign in to comment.