From 43f5f62c9fdfa8ffd861b9dde3f4df1940ebab27 Mon Sep 17 00:00:00 2001 From: JeanIrad Date: Sun, 21 Jul 2024 18:59:14 +0200 Subject: [PATCH] finishes #187988989 adding enable2FA field to response --- package.json | 2 ++ src/controllers/userController.ts | 2 +- src/server.ts | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index dada7409..e4538591 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "license": "ISC", "dependencies": { "@types/express-winston": "^4.0.0", + "@types/morgan": "^1.9.9", "@types/passport-jwt": "^4.0.1", "@types/winston": "^2.4.4", "bcrypt": "^5.1.1", @@ -88,6 +89,7 @@ "husky": "^8.0.3", "jest": "^29.7.0", "lint-staged": "^15.2.2", + "morgan": "^1.10.0", "ncp": "^2.0.0", "nodemon": "^3.1.0", "prettier": "^3.2.5", diff --git a/src/controllers/userController.ts b/src/controllers/userController.ts index 1005b7eb..1e2bf9fe 100644 --- a/src/controllers/userController.ts +++ b/src/controllers/userController.ts @@ -143,7 +143,7 @@ export const getOneUser = async (req: Request, res: Response) => { const { id } = req.params; const user: User | null = await User.findOne({ where: { id }, - attributes: ['id', 'firstName', 'lastName', 'email', 'phoneNumber', 'photoUrl', 'gender'], + attributes: ['id', 'firstName', 'lastName', 'email', 'phoneNumber', 'photoUrl', 'gender', 'enable2FA'], include: { model: Role, attributes: ['name'], diff --git a/src/server.ts b/src/server.ts index 739440e0..0121b0fe 100644 --- a/src/server.ts +++ b/src/server.ts @@ -15,10 +15,12 @@ import scheduledTasks from './config/cornJobs'; import { socketSetUp } from './chatSetup'; import { IncomingMessage } from 'http'; +import morgan from 'morgan'; dotenv.config(); export const app: Application = express(); +if (process.env.NODE_ENV === 'development') app.use(morgan('dev')); app.use(cors()); app.use(passport.initialize()); app.use(