initial commit
This commit is contained in:
parent
445b0249d9
commit
e07df196a9
53
.gitignore
vendored
53
.gitignore
vendored
@ -1,50 +1,3 @@
|
||||
# These are some examples of commonly ignored file patterns.
|
||||
# You should customize this list as applicable to your project.
|
||||
# Learn more about .gitignore:
|
||||
# https://www.atlassian.com/git/tutorials/saving-changes/gitignore
|
||||
|
||||
# Node artifact files
|
||||
node_modules/
|
||||
dist/
|
||||
|
||||
# Compiled Java class files
|
||||
*.class
|
||||
|
||||
# Compiled Python bytecode
|
||||
*.py[cod]
|
||||
|
||||
# Log files
|
||||
*.log
|
||||
|
||||
# Package files
|
||||
*.jar
|
||||
|
||||
# Maven
|
||||
target/
|
||||
dist/
|
||||
|
||||
# JetBrains IDE
|
||||
.idea/
|
||||
|
||||
# Unit test reports
|
||||
TEST*.xml
|
||||
|
||||
# Generated by MacOS
|
||||
.DS_Store
|
||||
|
||||
# Generated by Windows
|
||||
Thumbs.db
|
||||
|
||||
# Applications
|
||||
*.app
|
||||
*.exe
|
||||
*.war
|
||||
|
||||
# Large media files
|
||||
*.mp4
|
||||
*.tiff
|
||||
*.avi
|
||||
*.flv
|
||||
*.mov
|
||||
*.wmv
|
||||
|
||||
/node_modules
|
||||
/storage
|
||||
.env
|
||||
16
app/config/db.config.js
Normal file
16
app/config/db.config.js
Normal file
@ -0,0 +1,16 @@
|
||||
require('dotenv').config();
|
||||
|
||||
const { logMsg } = require('../services/logger');
|
||||
module.exports = {
|
||||
|
||||
"development": {
|
||||
"username": process.env.USER_NAME,
|
||||
"password": process.env.PASSWORD,
|
||||
"database": process.env.DATABASE,
|
||||
"port": process.env.PORT,
|
||||
"host": process.env.HOST,
|
||||
"dialect": "mssql",
|
||||
"logging": (message) =>(logMsg.info(message))
|
||||
|
||||
}
|
||||
};
|
||||
112
app/controllers/obligation.controller.js
Normal file
112
app/controllers/obligation.controller.js
Normal file
@ -0,0 +1,112 @@
|
||||
const { sequelize,Test,OblicationMaster,OblicationBurearBankStatement} = require('../models')
|
||||
const { logMsg } = require('../services/logger.js');
|
||||
|
||||
exports.Welcome = (req, res) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
const Msg = "Welcome....!";
|
||||
console.log(Msg);
|
||||
logMsg.info("Api Call Success");
|
||||
res.send({'status':200 , message:"Success." ,'data': Msg});
|
||||
|
||||
} catch(err) {
|
||||
res.status(500).send({'status':404,
|
||||
message: err.message || "Some error occurred while inserting statements." ,'data': "No data"
|
||||
});
|
||||
} //end of try catch
|
||||
|
||||
};
|
||||
|
||||
|
||||
exports.ObligationMaster = async (req, res) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
await OblicationMaster.findAll({where : {is_active : 1} })
|
||||
.then(data =>
|
||||
{
|
||||
res.send({'status':200,'message':"success",'data':data});
|
||||
logMsg.info("Master Data List api call Success");
|
||||
})
|
||||
.catch(err => {
|
||||
res.send({'status':404,
|
||||
message: err.message || "Some error occurred while fetching Obligation masterdata." ,'data': "No data" });
|
||||
});
|
||||
|
||||
} catch(err) {
|
||||
res.send({'status':404,
|
||||
message: err.message || "Some error occurred while fetching Obligation masterdata masterdata." ,'data': "No data"
|
||||
});
|
||||
} //end of try catch
|
||||
|
||||
};
|
||||
|
||||
exports.CreateObligationMaster = async (req, res) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
await OblicationMaster.create(req.body)
|
||||
.then(data =>
|
||||
{
|
||||
res.send({'status':200,'message':"success",'data': data});
|
||||
})
|
||||
.catch(err => {
|
||||
res.send({'status':404,
|
||||
message: err.message || "Some error occurred while create Oblication masterdata." ,'data': "No data" });
|
||||
});
|
||||
|
||||
} catch(err) {
|
||||
res.send({'status':404,
|
||||
message: err.message || "Some error occurred while create Oblication masterdata." ,'data': "No data"
|
||||
});
|
||||
} //end of try catch
|
||||
};
|
||||
|
||||
|
||||
exports.CreateOblicationBurearBankStatement = async (req, res) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
await OblicationBurearBankStatement.create(req.body)
|
||||
.then(data =>
|
||||
{
|
||||
res.send({'status':200,'message':"success",'data': data});
|
||||
})
|
||||
.catch(err => {
|
||||
res.send({'status':404,
|
||||
message: err.message || "Some error occurred while create Oblication Burear BankStatement masterdata." ,'data': "No data" });
|
||||
});
|
||||
|
||||
}
|
||||
catch(err) {
|
||||
res.send({'status':404,
|
||||
message: err.message || "Some error occurred while create Oblication Burear BankStatement masterdata." ,'data': "No data"
|
||||
});
|
||||
} //end of try catch
|
||||
};
|
||||
|
||||
|
||||
exports.UpdateOblicationBurearBankStatement = async (req, res) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
id = req.body.id;
|
||||
delete req.body.id;
|
||||
await OblicationBurearBankStatement.update({is_active : 0 },{ where: { id: id }});
|
||||
OblicationBurearBankStatement.create(req.body).then(data =>
|
||||
{
|
||||
res.send({'status':200,'message':"success",'data':data});
|
||||
})
|
||||
.catch(err => {
|
||||
res.send({'status':404,
|
||||
message: err.message || "Some error occurred while retrieving statements." ,'data': "No data" });
|
||||
});
|
||||
|
||||
} catch(err) {
|
||||
res.send({'status':404,message: err.message || "Some error occurred while inserting statements." ,'data': "No data" });
|
||||
} //end of try catch
|
||||
|
||||
}
|
||||
|
||||
|
||||
47
app/models/ObligationBurearBankStatement.js
Normal file
47
app/models/ObligationBurearBankStatement.js
Normal file
@ -0,0 +1,47 @@
|
||||
'use strict'
|
||||
const { Model } = require('sequelize')
|
||||
module.exports = (sequelize, DataTypes) => {
|
||||
class OblicationBurearBankStatement extends Model {
|
||||
|
||||
}
|
||||
OblicationBurearBankStatement.init(
|
||||
{
|
||||
los_id: { type: DataTypes.STRING },
|
||||
lender: { type: DataTypes.STRING },
|
||||
loan_type: { type: DataTypes.STRING },
|
||||
loan_availed_sanctioned_amount: { type: DataTypes.INTEGER },
|
||||
name_of_bank: { type: DataTypes.STRING },
|
||||
loan_in_name_of_ac_type: { type: DataTypes.STRING },
|
||||
loan_ownership_status: { type: DataTypes.STRING },
|
||||
roi: { type: DataTypes.STRING },
|
||||
avg_peak_util_of_the_OD_or_CC: { type: DataTypes.STRING },
|
||||
nature_of_loan: { type: DataTypes.STRING },
|
||||
loan_identification_source: { type: DataTypes.STRING },
|
||||
sanction_date: { type: DataTypes.DATE },
|
||||
principal_outstanding: { type: DataTypes.INTEGER },
|
||||
monthly_oblig: { type: DataTypes.INTEGER },
|
||||
total_loan_tenure_months: { type: DataTypes.INTEGER },
|
||||
no_of_instalments_paid: { type: DataTypes.INTEGER },
|
||||
balance_tenor_months: { type: DataTypes.INTEGER },
|
||||
loan_status_or_remarks: { type: DataTypes.STRING },
|
||||
consider_in_oblig: { type: DataTypes.STRING },
|
||||
reason_for_not_considering_in_oblig: { type: DataTypes.STRING },
|
||||
charge_filed_with_roc: { type: DataTypes.STRING },
|
||||
emi_tracking_month_1: { type: DataTypes.INTEGER },
|
||||
emi_tracking_month_2: { type: DataTypes.INTEGER },
|
||||
emi_tracking_month_3: { type: DataTypes.INTEGER },
|
||||
emi_tracking_month_4: { type: DataTypes.INTEGER },
|
||||
emi_tracking_month_5: { type: DataTypes.INTEGER },
|
||||
emi_tracking_month_6: { type: DataTypes.INTEGER },
|
||||
is_active: { type: DataTypes.INTEGER }
|
||||
},
|
||||
{
|
||||
sequelize,
|
||||
tableName: 'obligation_burear_bank_statement',
|
||||
modelName: 'OblicationBurearBankStatement',
|
||||
}
|
||||
)
|
||||
|
||||
return OblicationBurearBankStatement
|
||||
|
||||
}
|
||||
24
app/models/OblogationMaster.js
Normal file
24
app/models/OblogationMaster.js
Normal file
@ -0,0 +1,24 @@
|
||||
'use strict'
|
||||
const { Model } = require('sequelize')
|
||||
module.exports = (sequelize, DataTypes) => {
|
||||
class OblicationMaster extends Model {
|
||||
|
||||
}
|
||||
OblicationMaster.init(
|
||||
{
|
||||
master_name: { type: DataTypes.STRING },
|
||||
value: { type: DataTypes.STRING },
|
||||
is_active: { type: DataTypes.INTEGER }
|
||||
},
|
||||
{
|
||||
sequelize,
|
||||
tableName: 'obligation_master',
|
||||
modelName: 'OblicationMaster',
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
|
||||
return OblicationMaster
|
||||
|
||||
}
|
||||
31
app/models/Test.js
Normal file
31
app/models/Test.js
Normal file
@ -0,0 +1,31 @@
|
||||
'use strict'
|
||||
const { Model } = require('sequelize')
|
||||
module.exports = (sequelize, DataTypes) => {
|
||||
class Test extends Model {
|
||||
/**
|
||||
* Helper method for defining associations.
|
||||
* This method is not a part of Sequelize lifecycle.
|
||||
* The `models/index` file will call this method automatically.
|
||||
*/
|
||||
// define association here
|
||||
// static associate({ Financials }) {
|
||||
// this.hasMany(Financials, { foreignKey: 'entity_id', as: 'financialsData' })
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
Test.init(
|
||||
{
|
||||
losid: { type: DataTypes.STRING },
|
||||
createdby: { type: DataTypes.INTEGER },
|
||||
updatedby: { type: DataTypes.INTEGER },
|
||||
|
||||
},
|
||||
{
|
||||
sequelize,
|
||||
tableName: 'test',
|
||||
modelName: 'Test',
|
||||
}
|
||||
)
|
||||
return Test
|
||||
}
|
||||
39
app/models/index.js
Normal file
39
app/models/index.js
Normal file
@ -0,0 +1,39 @@
|
||||
'use strict';
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const Sequelize = require('sequelize');
|
||||
const basename = path.basename(__filename);
|
||||
const env = process.env.NODE_ENV || 'development';
|
||||
const config = require(__dirname + '/../config/db.config.js')[env];
|
||||
//console.log(env);
|
||||
//console.log(config);
|
||||
const db = {};
|
||||
|
||||
let sequelize;
|
||||
if (config.use_env_variable) {
|
||||
sequelize = new Sequelize(process.env[config.use_env_variable], config);
|
||||
} else {
|
||||
sequelize = new Sequelize(config.database, config.username, config.password, config);
|
||||
}
|
||||
|
||||
fs
|
||||
.readdirSync(__dirname)
|
||||
.filter(file => {
|
||||
return (file.indexOf('.') !== 0) && (file !== basename) && (file.slice(-3) === '.js');
|
||||
})
|
||||
.forEach(file => {
|
||||
const model = require(path.join(__dirname, file))(sequelize, Sequelize.DataTypes);
|
||||
db[model.name] = model;
|
||||
});
|
||||
|
||||
Object.keys(db).forEach(modelName => {
|
||||
if (db[modelName].associate) {
|
||||
db[modelName].associate(db);
|
||||
}
|
||||
});
|
||||
|
||||
db.sequelize = sequelize;
|
||||
db.Sequelize = Sequelize;
|
||||
|
||||
module.exports = db;
|
||||
383
app/routes/routes.js
Normal file
383
app/routes/routes.js
Normal file
@ -0,0 +1,383 @@
|
||||
module.exports = app => {
|
||||
const request = require("request");
|
||||
const cors=require('cors');
|
||||
const Mycontroller = require("../controllers/obligation.controller.js");
|
||||
const { logMsg } = require('../services/logger.js');
|
||||
var router = require("express").Router();
|
||||
|
||||
|
||||
|
||||
|
||||
//demo api
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* /api/demo:
|
||||
* get:
|
||||
* summary: Demo Api
|
||||
* description: Welcome Message
|
||||
* responses:
|
||||
* 200:
|
||||
* description: success
|
||||
*/
|
||||
router.get("/demo", Mycontroller.Welcome);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// get obligation masterdata
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* /api/obligationmaster:
|
||||
* get:
|
||||
* summary: Obligation masterdata Api
|
||||
* description: Obligation masterdata
|
||||
* responses:
|
||||
* 200:
|
||||
* description: success
|
||||
*/
|
||||
router.get("/obligationmaster",Mycontroller.ObligationMaster)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// create oblication burear bankstatement
|
||||
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* definitions:
|
||||
* createobligationmaster:
|
||||
* type: object
|
||||
* properties:
|
||||
* master_name:
|
||||
* type: string
|
||||
* description: masterName
|
||||
* example: loan_type
|
||||
* value:
|
||||
* type: string
|
||||
* description: value
|
||||
* example: Credit Card
|
||||
* is_active:
|
||||
* type: integer
|
||||
* description: isActive
|
||||
* example: 1
|
||||
*/
|
||||
/**
|
||||
* @swagger
|
||||
* /api/createobligationmaster:
|
||||
* post:
|
||||
* summary: create Oblication masterdata details
|
||||
* description: create a Oblication masterdata
|
||||
* requestBody:
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: '#/definitions/createobligationmaster'
|
||||
* responses:
|
||||
* 200:
|
||||
* description: New Oblication masterdata details inserted
|
||||
* 500:
|
||||
* description: failure in inserting Oblication masterdata details
|
||||
*/
|
||||
router.post("/createobligationmaster",Mycontroller.CreateObligationMaster)
|
||||
|
||||
|
||||
|
||||
|
||||
// create oblication burear bankstatement
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* definitions:
|
||||
* createoblicationburearbankstatement:
|
||||
* type: object
|
||||
* properties:
|
||||
* los_id:
|
||||
* type: string
|
||||
* description: losid
|
||||
* example: 123ab
|
||||
* lender:
|
||||
* type: string
|
||||
* description: lender
|
||||
* example: name
|
||||
* loan_type:
|
||||
* type: string
|
||||
* description: loantype
|
||||
* example: Credit Card
|
||||
* loan_availed_sanctioned_amount:
|
||||
* type: integer
|
||||
* description: loanAvailedSanctionedAmount
|
||||
* example: 10000
|
||||
* name_of_bank:
|
||||
* type: string
|
||||
* description: bankName
|
||||
* example: sbi
|
||||
* loan_in_name_of_ac_type:
|
||||
* type: string
|
||||
* description: nameOfAcType
|
||||
* example: Applicant
|
||||
* loan_ownership_status:
|
||||
* type: string
|
||||
* description: LoanOwnershipStatus
|
||||
* example: Joint
|
||||
* roi:
|
||||
* type: string
|
||||
* description: roi
|
||||
* example: 10%
|
||||
* avg_peak_util_of_the_OD_or_CC:
|
||||
* type: string
|
||||
* description: avgPeakUtilOfTheOD_or_CC
|
||||
* example: 5000
|
||||
* nature_of_loan:
|
||||
* type: string
|
||||
* description: natureOfLoan
|
||||
* example: Unsecured
|
||||
* loan_identification_source:
|
||||
* type: string
|
||||
* description: loanIdentificationSource
|
||||
* example: Credit Bureau Report
|
||||
* sanction_date:
|
||||
* type: string
|
||||
* description: sanctionDate
|
||||
* example: 10-2-2020
|
||||
* principal_outstanding:
|
||||
* type: integer
|
||||
* description: principalOutstanding
|
||||
* example: 1
|
||||
* monthly_oblig:
|
||||
* type: integer
|
||||
* description: monthlyOblig
|
||||
* example: 1
|
||||
* total_loan_tenure_months:
|
||||
* type: integer
|
||||
* description: totalLoanTenureMonths
|
||||
* example: 1
|
||||
* no_of_instalments_paid:
|
||||
* type: integer
|
||||
* description: noOfInstalmentsPaid
|
||||
* example: 1
|
||||
* balance_tenor_months:
|
||||
* type: integer
|
||||
* description: balanceTenorMonths
|
||||
* example: 1
|
||||
* loan_status_or_remarks:
|
||||
* type: string
|
||||
* description: loanStatusOrRemarks
|
||||
* example: Positive
|
||||
* consider_in_oblig:
|
||||
* type: string
|
||||
* description: considerInOblig
|
||||
* example: No
|
||||
* reason_for_not_considering_in_oblig:
|
||||
* type: string
|
||||
* description: reasonForNotConsideringInOblig
|
||||
* example: Already Closed
|
||||
* charge_filed_with_roc:
|
||||
* type: string
|
||||
* description: chargeFiledWithRoc
|
||||
* example: Yes
|
||||
* emi_tracking_month_1:
|
||||
* type: integer
|
||||
* description: emiTrackingMonth_1
|
||||
* example: 1
|
||||
* emi_tracking_month_2:
|
||||
* type: integer
|
||||
* description: emiTrackingMonth_2
|
||||
* example: 1
|
||||
* emi_tracking_month_3:
|
||||
* type: integer
|
||||
* description: emiTrackingMonth_3
|
||||
* example: 1
|
||||
* emi_tracking_month_4:
|
||||
* type: integer
|
||||
* description: emiTrackingMonth_4
|
||||
* example: 1
|
||||
* emi_tracking_month_5:
|
||||
* type: integer
|
||||
* description: emiTrackingMonth_5
|
||||
* example: 1
|
||||
* emi_tracking_month_6:
|
||||
* type: integer
|
||||
* description: emiTrackingMonth_6
|
||||
* example: 1
|
||||
* is_active:
|
||||
* type: integer
|
||||
* description: isActive
|
||||
* example: 1
|
||||
*/
|
||||
/**
|
||||
* @swagger
|
||||
* /api/createoblicationburearbankstatement:
|
||||
* post:
|
||||
* summary: create Oblication Burear BankStatement details
|
||||
* description: create a Oblication Burear BankStatement
|
||||
* requestBody:
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: '#/definitions/createoblicationburearbankstatement'
|
||||
* responses:
|
||||
* 200:
|
||||
* description: New Oblication Burear BankStatement details inserted
|
||||
* 500:
|
||||
* description: failure in inserting Oblication Burear BankStatement details
|
||||
*/
|
||||
router.post("/createoblicationburearbankstatement",Mycontroller.CreateOblicationBurearBankStatement)
|
||||
|
||||
|
||||
|
||||
|
||||
// update Oblication Burear BankStatement
|
||||
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* definitions:
|
||||
* updateoblicationburearbankstatement:
|
||||
* type: object
|
||||
* properties:
|
||||
* los_id:
|
||||
* type: string
|
||||
* description: losid
|
||||
* example: 123ab
|
||||
* lender:
|
||||
* type: string
|
||||
* description: lender
|
||||
* example: name
|
||||
* loan_type:
|
||||
* type: string
|
||||
* description: loantype
|
||||
* example: Credit Card
|
||||
* loan_availed_sanctioned_amount:
|
||||
* type: integer
|
||||
* description: loanAvailedSanctionedAmount
|
||||
* example: 10000
|
||||
* name_of_bank:
|
||||
* type: string
|
||||
* description: bankName
|
||||
* example: sbi
|
||||
* loan_in_name_of_ac_type:
|
||||
* type: string
|
||||
* description: nameOfAcType
|
||||
* example: Applicant
|
||||
* loan_ownership_status:
|
||||
* type: string
|
||||
* description: LoanOwnershipStatus
|
||||
* example: Joint
|
||||
* roi:
|
||||
* type: string
|
||||
* description: roi
|
||||
* example: 10%
|
||||
* avg_peak_util_of_the_OD_or_CC:
|
||||
* type: string
|
||||
* description: avgPeakUtilOfTheOD_or_CC
|
||||
* example:5000
|
||||
* nature_of_loan:
|
||||
* type: string
|
||||
* description: natureOfLoan
|
||||
* example: Unsecured
|
||||
* loan_identification_source:
|
||||
* type: string
|
||||
* description: loanIdentificationSource
|
||||
* example: Credit Bureau Report
|
||||
* sanction_date:
|
||||
* type: string
|
||||
* description: sanctionDate
|
||||
* example: 10-2-2020
|
||||
* principal_outstanding:
|
||||
* type: integer
|
||||
* description: principalOutstanding
|
||||
* example: 1
|
||||
* monthly_oblig:
|
||||
* type: integer
|
||||
* description: monthlyOblig
|
||||
* example: 1
|
||||
* total_loan_tenure_months:
|
||||
* type: integer
|
||||
* description: totalLoanTenureMonths
|
||||
* example: 1
|
||||
* no_of_instalments_paid:
|
||||
* type: integer
|
||||
* description: noOfInstalmentsPaid
|
||||
* example: 1
|
||||
* balance_tenor_months:
|
||||
* type: integer
|
||||
* description: balanceTenorMonths
|
||||
* example: 1
|
||||
* loan_status_or_remarks:
|
||||
* type: string
|
||||
* description: loanStatusOrRemarks
|
||||
* example: Positive
|
||||
* consider_in_oblig:
|
||||
* type: string
|
||||
* description: considerInOblig
|
||||
* example: No
|
||||
* reason_for_not_considering_in_oblig:
|
||||
* type: string
|
||||
* description: reasonForNotConsideringInOblig
|
||||
* example: Already Closed
|
||||
* charge_filed_with_roc:
|
||||
* type: string
|
||||
* description: chargeFiledWithRoc
|
||||
* example: Yes
|
||||
* emi_tracking_month_1:
|
||||
* type: integer
|
||||
* description: emiTrackingMonth_1
|
||||
* example: 1
|
||||
* emi_tracking_month_2:
|
||||
* type: integer
|
||||
* description: emiTrackingMonth_2
|
||||
* example: 1
|
||||
* emi_tracking_month_3:
|
||||
* type: integer
|
||||
* description: emiTrackingMonth_3
|
||||
* example: 1
|
||||
* emi_tracking_month_4:
|
||||
* type: integer
|
||||
* description: emiTrackingMonth_4
|
||||
* example: 1
|
||||
* emi_tracking_month_5:
|
||||
* type: integer
|
||||
* description: emiTrackingMonth_5
|
||||
* example: 1
|
||||
* emi_tracking_month_6:
|
||||
* type: integer
|
||||
* description: emiTrackingMonth_6
|
||||
* example: 1
|
||||
* is_active:
|
||||
* type: integer
|
||||
* description: isActive
|
||||
* example: 1
|
||||
*/
|
||||
/**
|
||||
* @swagger
|
||||
* /api/updateoblicationburearbankstatement:
|
||||
* post:
|
||||
* summary: create Oblication Burear BankStatement details
|
||||
* description: create a Oblication Burear BankStatement
|
||||
* requestBody:
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: '#/definitions/updateoblicationburearbankstatement'
|
||||
* responses:
|
||||
* 200:
|
||||
* description: update Oblication Burear BankStatement details inserted
|
||||
* 500:
|
||||
* description: failure in updating Oblication Burear BankStatement details
|
||||
*/
|
||||
router.post("/updateoblicationburearbankstatement",Mycontroller.UpdateOblicationBurearBankStatement)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// routes started here
|
||||
app.use('/api', router);
|
||||
};
|
||||
|
||||
|
||||
27
app/services/logger.js
Normal file
27
app/services/logger.js
Normal file
@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Configurations of logger.
|
||||
*/
|
||||
var winston = require('winston');
|
||||
require('winston-daily-rotate-file');
|
||||
|
||||
var transport = new winston.transports.DailyRotateFile({
|
||||
filename: 'storage/log/msg.log',
|
||||
datePattern: 'YYYY-MM-DD',
|
||||
zippedArchive: true,
|
||||
maxSize: '20m',
|
||||
maxFiles: '14d'
|
||||
});
|
||||
|
||||
transport.on('rotate', function(oldFilename, newFilename) {
|
||||
// do something fun
|
||||
});
|
||||
|
||||
const logger = winston.createLogger({
|
||||
transports: [
|
||||
transport
|
||||
]
|
||||
});
|
||||
module.exports = {
|
||||
'logMsg': logger,
|
||||
};
|
||||
|
||||
8426
package-lock.json
generated
Normal file
8426
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
29
package.json
Normal file
29
package.json
Normal file
@ -0,0 +1,29 @@
|
||||
{
|
||||
"name": "smc_cet_oblication_backend",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "server.js",
|
||||
"scripts": {
|
||||
"start": "nodemon server.js"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"body-parser": "^1.19.0",
|
||||
"cors": "^2.8.5",
|
||||
"dotenv": "^10.0.0",
|
||||
"express": "^4.17.1",
|
||||
"log4js": "^6.3.0",
|
||||
"mssql": "^7.2.0",
|
||||
"request": "^2.88.2",
|
||||
"sequelize": "^6.6.5",
|
||||
"swagger-jsdoc": "^6.1.0",
|
||||
"swagger-ui-express": "^4.1.6",
|
||||
"winston": "^3.3.3",
|
||||
"winston-daily-rotate-file": "^4.5.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"nodemon": "^2.0.12"
|
||||
}
|
||||
}
|
||||
62
server.js
Normal file
62
server.js
Normal file
@ -0,0 +1,62 @@
|
||||
require('dotenv').config();
|
||||
const express = require('express')
|
||||
const app = express()
|
||||
//it is used to clear cache
|
||||
app.use(function(req, res, next) {
|
||||
res.set("Cache-Control", "no-cache, no-store, must-revalidate, max-age=0")
|
||||
res.set("Pragma", "no-cache")
|
||||
res.set("Expires", 0)
|
||||
next()
|
||||
})
|
||||
const {logMsg} = require('./app/services/logger.js');
|
||||
|
||||
const swaggerJsdoc = require('swagger-jsdoc');
|
||||
const swaggerUi = require('swagger-ui-express');
|
||||
|
||||
|
||||
|
||||
const options = {
|
||||
definition: {
|
||||
openapi: '3.0.0',
|
||||
info: {
|
||||
title: 'Smc_cet_financials',
|
||||
version: '1.0.0',
|
||||
},
|
||||
},
|
||||
apis: ['./app/routes/routes.js'], // files containing annotations as above
|
||||
};
|
||||
|
||||
const swaggerDocument = swaggerJsdoc(options);
|
||||
app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerDocument));
|
||||
|
||||
|
||||
/**
|
||||
* @openapi
|
||||
* /:
|
||||
* get:
|
||||
* description: Welcome to swagger-jsdoc!
|
||||
* responses:
|
||||
* 200:
|
||||
* description: Returns a mysterious string.
|
||||
*/
|
||||
|
||||
|
||||
app.get("/", (req, res) => {
|
||||
res.json({ message: "Welcome to the application." });
|
||||
logMsg.info("Server Sent A Welcome to the application!");
|
||||
|
||||
});
|
||||
|
||||
|
||||
app.use(express.json())
|
||||
app.use(express.urlencoded({ extended: true }));
|
||||
|
||||
|
||||
require("./app/routes/routes.js")(app);
|
||||
|
||||
const PORT_NUMBER = process.env.SERVER_PORT
|
||||
app.listen({ port: PORT_NUMBER }, async () => {
|
||||
console.log('Server up on http://localhost:7080')
|
||||
|
||||
//await sequelize.authenticate()
|
||||
})
|
||||
Loading…
Reference in New Issue
Block a user