From 98ab9954bf4b148c842cf87dbb1af3c7801e4b3d Mon Sep 17 00:00:00 2001 From: asif Date: Sun, 10 Aug 2025 15:38:38 +0530 Subject: [PATCH] code formatting in auth.service --- src/services/auth.service.js | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/src/services/auth.service.js b/src/services/auth.service.js index db520ec..b5cfe71 100644 --- a/src/services/auth.service.js +++ b/src/services/auth.service.js @@ -48,10 +48,10 @@ async function setTpin(customerNo, tpin) { async function setLoginPassword(customerNo, login_psw) { const hashedLoginPassword = await hashPassword(login_psw); try { - await db.query('UPDATE users SET password_hash = $1 ,is_first_login = false WHERE customer_no = $2', [ - hashedLoginPassword, - customerNo, - ]); + await db.query( + 'UPDATE users SET password_hash = $1 ,is_first_login = false WHERE customer_no = $2', + [hashedLoginPassword, customerNo] + ); } catch (error) { throw new Error( `error occured while while setting new Login Password ${error.message}` @@ -62,7 +62,7 @@ async function setLoginPassword(customerNo, login_psw) { async function validateTransactionPassword(customerNo, tpassword) { const user = await findUserByCustomerNo(customerNo); if (!user?.transaction_password) return null; - const isMatch = await comparePassword(tpassword, user.transaction_password ); + const isMatch = await comparePassword(tpassword, user.transaction_password); return isMatch; } @@ -70,10 +70,10 @@ async function validateTransactionPassword(customerNo, tpassword) { async function setTransactionPassword(customerNo, trans_psw) { const hashedTransPassword = await hashPassword(trans_psw); try { - await db.query('UPDATE users SET transaction_password = $1 WHERE customer_no = $2', [ - hashedTransPassword, - customerNo, - ]); + await db.query( + 'UPDATE users SET transaction_password = $1 WHERE customer_no = $2', + [hashedTransPassword, customerNo] + ); } catch (error) { throw new Error( `error occured while while setting new Transaction Password ${error.message}` @@ -81,5 +81,13 @@ async function setTransactionPassword(customerNo, trans_psw) { } } -module.exports = { validateUser, findUserByCustomerNo, setTpin, validateTpin, - CheckFirstTimeLogin, setLoginPassword, validateTransactionPassword,setTransactionPassword }; +module.exports = { + validateUser, + findUserByCustomerNo, + setTpin, + validateTpin, + CheckFirstTimeLogin, + setLoginPassword, + validateTransactionPassword, + setTransactionPassword, +};