feat : Admin can unlocked users

feat : admin can update and create users.
This commit is contained in:
2025-11-04 13:02:18 +05:30
parent 43cce9f04a
commit 56c69e54de
5 changed files with 55 additions and 13 deletions

View File

@@ -38,10 +38,19 @@ async function getCustomerDetails(customerNo) {
}
async function getCustomerDetailsFromDB(customerNo) {
const result = await db.query('SELECT customer_no,created_at,last_login,is_first_login,ib_access_level,mb_access_level FROM users WHERE customer_no = $1', [
const result = await db.query(
'SELECT customer_no,created_at,last_login,is_first_login,ib_access_level,mb_access_level,inb_limit_amount,mobile_limit_amount,locked FROM users WHERE customer_no = $1 or preferred_name= $1', [
customerNo,
]);
return result.rows[0];
}
module.exports = { validateAdmin, findAdminByUserName, getCustomerDetails,getCustomerDetailsFromDB };
async function updateUserLockStatus(customerNo ,locked ,adminUserName) {
const result = await db.query(
'Update users set locked =$2 ,unlocked_by=$3 WHERE customer_no = $1 or preferred_name= $1', [
customerNo, locked ,adminUserName
]);
return result.rows[0];
}
module.exports = { validateAdmin, findAdminByUserName, getCustomerDetails, getCustomerDetailsFromDB ,updateUserLockStatus };