implemented a simple backend for mobile banking
This commit is contained in:
25
src/controllers/auth.controller.js
Normal file
25
src/controllers/auth.controller.js
Normal file
@@ -0,0 +1,25 @@
|
||||
const { validateUser } = require('../services/auth.service');
|
||||
const { generateToken } = require('../util/jwt');
|
||||
const { logger } = require('../util/logger');
|
||||
|
||||
async function login(req, res) {
|
||||
const { customerNo, password } = req.body;
|
||||
|
||||
if (!customerNo || !password) {
|
||||
return res
|
||||
.status(400)
|
||||
.json({ error: 'customerNo and password are required' });
|
||||
}
|
||||
|
||||
try {
|
||||
const user = await validateUser(customerNo, password);
|
||||
if (!user) return res.status(401).json({ error: 'invalid credentials' });
|
||||
const token = generateToken(user.customer_no);
|
||||
res.json({ token });
|
||||
} catch (err) {
|
||||
logger.error(err, 'login failed');
|
||||
res.status(500).json({ error: 'something went wrong' });
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { login };
|
9
src/controllers/details.js
Normal file
9
src/controllers/details.js
Normal file
@@ -0,0 +1,9 @@
|
||||
const { logger } = require('../util/logger');
|
||||
const detailsObject = require('./rajatDetails_wt.json');
|
||||
|
||||
function getDetails(user) {
|
||||
logger.info(user);
|
||||
return detailsObject;
|
||||
}
|
||||
|
||||
module.exports = { getDetails };
|
116
src/controllers/rajatDetails_nt.json
Normal file
116
src/controllers/rajatDetails_nt.json
Normal file
@@ -0,0 +1,116 @@
|
||||
[
|
||||
{
|
||||
"stAccountNo": "50067217630",
|
||||
"stAccountType": "SA",
|
||||
"stBookingNumber": "SAVING CHQ FOR NONME",
|
||||
"stBranchNo": "00002 ",
|
||||
"stCurrency": "INR",
|
||||
"stProductType": "SAVING CHQ FOR NONME",
|
||||
"stApprovedAmount": null,
|
||||
"stAvailableBalance": "933.84",
|
||||
"stCurrentBalance": "933.84",
|
||||
"custdob": "02051982",
|
||||
"custname": "RAJAT MAHARANA",
|
||||
"mobileno": "919418573848",
|
||||
"custaddress": "DATA CENTRE KCCB CIVIL BAZAR D/SHALA DHARAMSHALA KANGRA",
|
||||
"pincode": "176215",
|
||||
"id": "AMSPM8798H",
|
||||
"activeAccounts": 6,
|
||||
"cifNumber": "30022497139"
|
||||
},
|
||||
{
|
||||
"stAccountNo": "50077736845",
|
||||
"stAccountType": "TD",
|
||||
"stBookingNumber": "TD-LTD-NM-IND -1 Yrs",
|
||||
"stBranchNo": "00002 ",
|
||||
"stCurrency": "INR",
|
||||
"stProductType": "TD-LTD-NM-IND -1 Yrs",
|
||||
"stApprovedAmount": null,
|
||||
"stAvailableBalance": "10000.00",
|
||||
"stCurrentBalance": "10000.00",
|
||||
"custdob": "02051982",
|
||||
"custname": "RAJAT MAHARANA",
|
||||
"mobileno": "919418573848",
|
||||
"custaddress": "DATA CENTRE KCCB CIVIL BAZAR D/SHALA DHARAMSHALA KANGRA",
|
||||
"pincode": "176215",
|
||||
"id": "AMSPM8798H",
|
||||
"activeAccounts": 6,
|
||||
"cifNumber": "30022497139"
|
||||
},
|
||||
{
|
||||
"stAccountNo": "50077742351",
|
||||
"stAccountType": "LN",
|
||||
"stBookingNumber": "DL-AGAINST DEPOSIT",
|
||||
"stBranchNo": "00002 ",
|
||||
"stCurrency": "INR",
|
||||
"stProductType": "DL-AGAINST DEPOSIT",
|
||||
"stApprovedAmount": "10000.00",
|
||||
"stAvailableBalance": "10236.00",
|
||||
"stCurrentBalance": "10236.00",
|
||||
"custdob": "02051982",
|
||||
"custname": "RAJAT MAHARANA",
|
||||
"mobileno": "919418573848",
|
||||
"custaddress": "DATA CENTRE KCCB CIVIL BAZAR D/SHALA DHARAMSHALA KANGRA",
|
||||
"pincode": "176215",
|
||||
"id": "AMSPM8798H",
|
||||
"activeAccounts": 6,
|
||||
"cifNumber": "30022497139"
|
||||
},
|
||||
{
|
||||
"stAccountNo": "50077756089",
|
||||
"stAccountType": "TD",
|
||||
"stBookingNumber": "TD-LTD-NM-IND -1 Yrs",
|
||||
"stBranchNo": "00002 ",
|
||||
"stCurrency": "INR",
|
||||
"stProductType": "TD-LTD-NM-IND -1 Yrs",
|
||||
"stApprovedAmount": null,
|
||||
"stAvailableBalance": "10000.00",
|
||||
"stCurrentBalance": "10000.00",
|
||||
"custdob": "02051982",
|
||||
"custname": "RAJAT MAHARANA",
|
||||
"mobileno": "919418573848",
|
||||
"custaddress": "DATA CENTRE KCCB CIVIL BAZAR D/SHALA DHARAMSHALA KANGRA",
|
||||
"pincode": "176215",
|
||||
"id": "AMSPM8798H",
|
||||
"activeAccounts": 6,
|
||||
"cifNumber": "30022497139"
|
||||
},
|
||||
{
|
||||
"stAccountNo": "50077842356",
|
||||
"stAccountType": "LN",
|
||||
"stBookingNumber": "DL-AGAINST DEPOSIT",
|
||||
"stBranchNo": "00002 ",
|
||||
"stCurrency": "INR",
|
||||
"stProductType": "DL-AGAINST DEPOSIT",
|
||||
"stApprovedAmount": "10000.00",
|
||||
"stAvailableBalance": "10215.00",
|
||||
"stCurrentBalance": "10215.00",
|
||||
"custdob": "02051982",
|
||||
"custname": "RAJAT MAHARANA",
|
||||
"mobileno": "919418573848",
|
||||
"custaddress": "DATA CENTRE KCCB CIVIL BAZAR D/SHALA DHARAMSHALA KANGRA",
|
||||
"pincode": "176215",
|
||||
"id": "AMSPM8798H",
|
||||
"activeAccounts": 6,
|
||||
"cifNumber": "30022497139"
|
||||
},
|
||||
{
|
||||
"stAccountNo": "50078072406",
|
||||
"stAccountType": "LN",
|
||||
"stBookingNumber": "TL-PERSONAL",
|
||||
"stBranchNo": "00002 ",
|
||||
"stCurrency": "INR",
|
||||
"stProductType": "TL-PERSONAL",
|
||||
"stApprovedAmount": "200000.00",
|
||||
"stAvailableBalance": "200825.00",
|
||||
"stCurrentBalance": "200825.00",
|
||||
"custdob": "02051982",
|
||||
"custname": "RAJAT MAHARANA",
|
||||
"mobileno": "919418573848",
|
||||
"custaddress": "DATA CENTRE KCCB CIVIL BAZAR D/SHALA DHARAMSHALA KANGRA",
|
||||
"pincode": "176215",
|
||||
"id": "AMSPM8798H",
|
||||
"activeAccounts": 6,
|
||||
"cifNumber": "30022497139"
|
||||
}
|
||||
]
|
212
src/controllers/rajatDetails_wt.json
Normal file
212
src/controllers/rajatDetails_wt.json
Normal file
@@ -0,0 +1,212 @@
|
||||
[
|
||||
{
|
||||
"stAccountNo": "50067217630",
|
||||
"stAccountType": "SA",
|
||||
"stBookingNumber": "SAVING CHQ FOR NONME",
|
||||
"stBranchNo": "00002 ",
|
||||
"stCurrency": "INR",
|
||||
"stProductType": "SAVING CHQ FOR NONME",
|
||||
"stApprovedAmount": null,
|
||||
"stAvailableBalance": "933.84",
|
||||
"stCurrentBalance": "933.84",
|
||||
"custdob": "02051982",
|
||||
"custname": "RAJAT MAHARANA",
|
||||
"mobileno": "919418573848",
|
||||
"custaddress": "DATA CENTRE KCCB CIVIL BAZAR D/SHALA DHARAMSHALA KANGRA",
|
||||
"pincode": "176215",
|
||||
"id": "AMSPM8798H",
|
||||
"transactions": [
|
||||
{
|
||||
"id": "abcd",
|
||||
"name": "John Doe",
|
||||
"date": "31-05-2025 09:05:31",
|
||||
"type": "CR",
|
||||
"amount": 612
|
||||
},
|
||||
{
|
||||
"id": "efgh",
|
||||
"name": "John Cena",
|
||||
"date": "20-05-2025 09:05:20",
|
||||
"type": "DR",
|
||||
"amount": 10
|
||||
}
|
||||
],
|
||||
"activeAccounts": 6,
|
||||
"cifNumber": "30022497139"
|
||||
},
|
||||
{
|
||||
"stAccountNo": "50077736845",
|
||||
"stAccountType": "TD",
|
||||
"stBookingNumber": "TD-LTD-NM-IND -1 Yrs",
|
||||
"stBranchNo": "00002 ",
|
||||
"stCurrency": "INR",
|
||||
"stProductType": "TD-LTD-NM-IND -1 Yrs",
|
||||
"stApprovedAmount": null,
|
||||
"stAvailableBalance": "10000.00",
|
||||
"stCurrentBalance": "10000.00",
|
||||
"custdob": "02051982",
|
||||
"custname": "RAJAT MAHARANA",
|
||||
"mobileno": "919418573848",
|
||||
"custaddress": "DATA CENTRE KCCB CIVIL BAZAR D/SHALA DHARAMSHALA KANGRA",
|
||||
"pincode": "176215",
|
||||
"id": "AMSPM8798H",
|
||||
"transactions": [
|
||||
{
|
||||
"id": "abcd",
|
||||
"name": "John Doe",
|
||||
"date": "31-05-2025 09:05:31",
|
||||
"type": "CR",
|
||||
"amount": 10
|
||||
},
|
||||
{
|
||||
"id": "efgh",
|
||||
"name": "John Cena",
|
||||
"date": "20-05-2025 09:05:20",
|
||||
"type": "DR",
|
||||
"amount": 662
|
||||
}
|
||||
],
|
||||
"activeAccounts": 6,
|
||||
"cifNumber": "30022497139"
|
||||
},
|
||||
{
|
||||
"stAccountNo": "50077742351",
|
||||
"stAccountType": "LN",
|
||||
"stBookingNumber": "DL-AGAINST DEPOSIT",
|
||||
"stBranchNo": "00002 ",
|
||||
"stCurrency": "INR",
|
||||
"stProductType": "DL-AGAINST DEPOSIT",
|
||||
"stApprovedAmount": "10000.00",
|
||||
"stAvailableBalance": "10236.00",
|
||||
"stCurrentBalance": "10236.00",
|
||||
"custdob": "02051982",
|
||||
"custname": "RAJAT MAHARANA",
|
||||
"mobileno": "919418573848",
|
||||
"custaddress": "DATA CENTRE KCCB CIVIL BAZAR D/SHALA DHARAMSHALA KANGRA",
|
||||
"pincode": "176215",
|
||||
"id": "AMSPM8798H",
|
||||
"transactions": [
|
||||
{
|
||||
"id": "abcd",
|
||||
"name": "John Doe",
|
||||
"date": "31-05-2025 09:05:31",
|
||||
"type": "CR",
|
||||
"amount": 676
|
||||
},
|
||||
{
|
||||
"id": "efgh",
|
||||
"name": "John Cena",
|
||||
"date": "20-05-2025 09:05:20",
|
||||
"type": "DR",
|
||||
"amount": 684
|
||||
}
|
||||
],
|
||||
"activeAccounts": 6,
|
||||
"cifNumber": "30022497139"
|
||||
},
|
||||
{
|
||||
"stAccountNo": "50077756089",
|
||||
"stAccountType": "TD",
|
||||
"stBookingNumber": "TD-LTD-NM-IND -1 Yrs",
|
||||
"stBranchNo": "00002 ",
|
||||
"stCurrency": "INR",
|
||||
"stProductType": "TD-LTD-NM-IND -1 Yrs",
|
||||
"stApprovedAmount": null,
|
||||
"stAvailableBalance": "10000.00",
|
||||
"stCurrentBalance": "10000.00",
|
||||
"custdob": "02051982",
|
||||
"custname": "RAJAT MAHARANA",
|
||||
"mobileno": "919418573848",
|
||||
"custaddress": "DATA CENTRE KCCB CIVIL BAZAR D/SHALA DHARAMSHALA KANGRA",
|
||||
"pincode": "176215",
|
||||
"id": "AMSPM8798H",
|
||||
"transactions": [
|
||||
{
|
||||
"id": "abcd",
|
||||
"name": "John Doe",
|
||||
"date": "31-05-2025 09:05:31",
|
||||
"type": "CR",
|
||||
"amount": 698
|
||||
},
|
||||
{
|
||||
"id": "efgh",
|
||||
"name": "John Cena",
|
||||
"date": "20-05-2025 09:05:20",
|
||||
"type": "DR",
|
||||
"amount": 706
|
||||
}
|
||||
],
|
||||
"activeAccounts": 6,
|
||||
"cifNumber": "30022497139"
|
||||
},
|
||||
{
|
||||
"stAccountNo": "50077842356",
|
||||
"stAccountType": "LN",
|
||||
"stBookingNumber": "DL-AGAINST DEPOSIT",
|
||||
"stBranchNo": "00002 ",
|
||||
"stCurrency": "INR",
|
||||
"stProductType": "DL-AGAINST DEPOSIT",
|
||||
"stApprovedAmount": "10000.00",
|
||||
"stAvailableBalance": "10215.00",
|
||||
"stCurrentBalance": "10215.00",
|
||||
"custdob": "02051982",
|
||||
"custname": "RAJAT MAHARANA",
|
||||
"mobileno": "919418573848",
|
||||
"custaddress": "DATA CENTRE KCCB CIVIL BAZAR D/SHALA DHARAMSHALA KANGRA",
|
||||
"pincode": "176215",
|
||||
"id": "AMSPM8798H",
|
||||
"transactions": [
|
||||
{
|
||||
"id": "abcd",
|
||||
"name": "John Doe",
|
||||
"date": "31-05-2025 09:05:31",
|
||||
"type": "CR",
|
||||
"amount": 721
|
||||
},
|
||||
{
|
||||
"id": "efgh",
|
||||
"name": "John Cena",
|
||||
"date": "20-05-2025 09:05:20",
|
||||
"type": "DR",
|
||||
"amount": 729
|
||||
}
|
||||
],
|
||||
"activeAccounts": 6,
|
||||
"cifNumber": "30022497139"
|
||||
},
|
||||
{
|
||||
"stAccountNo": "50078072406",
|
||||
"stAccountType": "LN",
|
||||
"stBookingNumber": "TL-PERSONAL",
|
||||
"stBranchNo": "00002 ",
|
||||
"stCurrency": "INR",
|
||||
"stProductType": "TL-PERSONAL",
|
||||
"stApprovedAmount": "200000.00",
|
||||
"stAvailableBalance": "200825.00",
|
||||
"stCurrentBalance": "200825.00",
|
||||
"custdob": "02051982",
|
||||
"custname": "RAJAT MAHARANA",
|
||||
"mobileno": "919418573848",
|
||||
"custaddress": "DATA CENTRE KCCB CIVIL BAZAR D/SHALA DHARAMSHALA KANGRA",
|
||||
"pincode": "176215",
|
||||
"id": "AMSPM8798H",
|
||||
"transactions": [
|
||||
{
|
||||
"id": "abcd",
|
||||
"name": "John Doe",
|
||||
"date": "31-05-2025 09:05:31",
|
||||
"type": "CR",
|
||||
"amount": 10
|
||||
},
|
||||
{
|
||||
"id": "efgh",
|
||||
"name": "John Cena",
|
||||
"date": "20-05-2025 09:05:20",
|
||||
"type": "DR",
|
||||
"amount": 751
|
||||
}
|
||||
],
|
||||
"activeAccounts": 6,
|
||||
"cifNumber": "30022497139"
|
||||
}
|
||||
]
|
Reference in New Issue
Block a user