susee
This commit is contained in:
parent
912733ac58
commit
0ad4a4f8d7
53
.gitignore
vendored
53
.gitignore
vendored
@ -1,50 +1,3 @@
|
|||||||
# These are some examples of commonly ignored file patterns.
|
/node_modules
|
||||||
# You should customize this list as applicable to your project.
|
/storage
|
||||||
# Learn more about .gitignore:
|
.env
|
||||||
# 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
|
|
||||||
|
|
||||||
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))
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
72
app/controllers/test.controller.js
Normal file
72
app/controllers/test.controller.js
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
const { sequelize,Test,GeneralSection ,FundRequirement , DetailsOfKeyShareHolder , BreifOfBusiness , FinancialInformation , PropertyInformationn , FinalRemarks , OfficerDetails , Photograph , InstitutionDetail , ProductInformation} = 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.SalesPd = async (req, res) =>
|
||||||
|
{
|
||||||
|
|
||||||
|
const tempData ={"section1":{"main_loan_applicant":"AKSHAR ENTERPRISE","company_name":"AKSHAR ENTERPRISE","person_met_during_visit":"SATWARA MANISH","address_visited":"SHED NO C 39 SURYAM INDUSTRIAL PARK NR TORRENT POWER SUBSTATION NICOL ","state":"Gujarat","city":"Ahmedabad","pincode":"382350"},"section2":{"loan_amount_applied":"25000000","total_fund_requirement":"30000000","loan_tenure":"36","loan_purpose":"Purchase of Business Assets"},"section3":[{"name":"SATHWARA MANISH","share_holding":"50","vintage_in_current_biz":"12"},{"name":"SATHWARA DHIRAJLAL HARDASBHAI","share_holding":"50","vintage_in_current_biz":"12"}],"section4":{"nature_of_business":"Trader","product_service_type":"LPG GAS TRADING","other_information":"RILIANCE LPG GAS"},"section5":{"0":{"fy":"2021-2022","sales_revenue":"59168882","net_profit":"2000000"},"income_considered":"2000000","income_assessment_program_recommended":"Vanilla","fixed_obligations":"1000000"},"section6":[{"property_address":"SHOP NO 601 TO 604 SUREEL BUSINESS HUB BS NARODA MUKTI DHAM SHALBI HOSPITAL ROAD NARODA","property_type":"SHOPS ","occupancy_status":"Vacant","permitted_property_usage":"Commercial","actual_property_usage":"Commercial","built_up_area":"6500","built_up_area_uom":"Sq Ft","approx_mkt_val":"40000000","Property_Ownership_Status":"PADMA ASSOCIATES "}],"section7":{"business_activity_seen":"Yes","location_workplace_suits_business":"Yes","overall_assessment":"Positive","recommended_roi":"13","any_other_remarks":""},"section8":{"name_of_sales_team_member":"Bhojak Krunalkumar Maheshkumar ","designation":"Sales Officer","date":"09-04-2022 2:01:16 PM"},"section9":{"selfie_with_person_met":"SAVED","approach_to_pd_location":["SAVED",""],"name_board_seen":["SAVED",""],"stock_image":["SAVED","SAVED","SAVED","SAVED",""],"workplace_interior_image":["SAVED","SAVED",""]}}
|
||||||
|
|
||||||
|
|
||||||
|
var count = 0;
|
||||||
|
var generalSectionData = [ ];
|
||||||
|
var storeId = [ ];
|
||||||
|
const len = Object.keys(tempData).length - 1;
|
||||||
|
for (const [keys, values] of Object.entries(tempData)) {
|
||||||
|
count++
|
||||||
|
if (Array.isArray(values) == true )
|
||||||
|
{
|
||||||
|
values.forEach(async(values) => {
|
||||||
|
if (keys == 'section1') { generalSectionData = await GeneralSection.create( values ); storeId = await GeneralSection.findOne({ where : { pd_id : generalSectionData.pd_id , is_active : 1 }}); };
|
||||||
|
if (keys == 'section2') { Object.assign(values, { pd_id: storeId.pd_id }); await FundRequirement.create( values ) };
|
||||||
|
if (keys == 'section3') { Object.assign(values, { pd_id: storeId.pd_id }); await DetailsOfKeyShareHolder.create( values) };
|
||||||
|
if (keys == 'section4') { Object.assign(values, { pd_id: storeId.pd_id }); await BreifOfBusiness.create( values) };
|
||||||
|
if (keys == 'section5') { Object.assign(values, { pd_id: storeId.pd_id }); await FinancialInformation.create( values) };
|
||||||
|
if (keys == 'section6') { Object.assign(values, { pd_id: storeId.pd_id }); await PropertyInformationn.create( values) };
|
||||||
|
if (keys == 'section7') { Object.assign(values, { pd_id: storeId.pd_id }); await FinalRemarks.create( values) };
|
||||||
|
if (keys == 'section8') { Object.assign(values, { pd_id: storeId.pd_id }); await OfficerDetails.create( values) };
|
||||||
|
// if (keys == 'section9') { Object.assign(values, { pd_id: storeId.pd_id }); await Photograph.create( values) };
|
||||||
|
if (keys == 'section10') { Object.assign(values, { pd_id: storeId.pd_id }); await InstitutionDetail.create( values) };
|
||||||
|
if (keys == 'section11') { Object.assign(values, { pd_id: storeId.pd_id }); await ProductInformation.create( values) };
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (keys == 'section1') { id = await GeneralSection.create( values ); storeId = await GeneralSection.findOne({ where : { pd_id : id.pd_id , is_active : 1 }}); };
|
||||||
|
if (keys == 'section2') { Object.assign(values, { pd_id: storeId.pd_id }); await FundRequirement.create( values ) };
|
||||||
|
if (keys == 'section3') { Object.assign(values, { pd_id: storeId.pd_id }); await DetailsOfKeyShareHolder.create( values) };
|
||||||
|
if (keys == 'section4') { Object.assign(values, { pd_id: storeId.pd_id }); await BreifOfBusiness.create( values) };
|
||||||
|
if (keys == 'section5') { Object.assign(values, { pd_id: storeId.pd_id }); await FinancialInformation.create( values) };
|
||||||
|
if (keys == 'section6') { Object.assign(values, { pd_id: storeId.pd_id }); await PropertyInformationn.create( values) };
|
||||||
|
if (keys == 'section7') { Object.assign(values, { pd_id: storeId.pd_id }); await FinalRemarks.create( values) };
|
||||||
|
if (keys == 'section8') { Object.assign(values, { pd_id: storeId.pd_id }); await OfficerDetails.create( values) };
|
||||||
|
// if (keys == 'section9') { Object.assign(values, { pd_id: storeId.pd_id }); await Photograph.create( values) };
|
||||||
|
if (keys == 'section10') { Object.assign(values, { pd_id: storeId.pd_id }); await InstitutionDetail.create( values) };
|
||||||
|
if (keys == 'section11') { Object.assign(values, { pd_id: storeId.pd_id }); await ProductInformation.create( values) };
|
||||||
|
}
|
||||||
|
if (len == count - 1 )
|
||||||
|
{
|
||||||
|
var resData = await GeneralSection.findAll({ where : { pd_id : storeId.pd_id , is_active : 1 },
|
||||||
|
include : [ {model: FundRequirement }, {model: DetailsOfKeyShareHolder }, {model: DetailsOfKeyShareHolder }, {model: BreifOfBusiness }, {model: FinancialInformation }, {model: PropertyInformationn }, {model: FinalRemarks }, {model: OfficerDetails }, {model: Photograph }, {model: InstitutionDetail }, {model: ProductInformation }]
|
||||||
|
})
|
||||||
|
res.send(resData)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
38
app/models/ClientDetail.js
Normal file
38
app/models/ClientDetail.js
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
'use strict'
|
||||||
|
const { Model } = require('sequelize')
|
||||||
|
module.exports = (sequelize, DataTypes) => {
|
||||||
|
class ClientDetail extends Model {
|
||||||
|
|
||||||
|
}
|
||||||
|
ClientDetail.init(
|
||||||
|
{
|
||||||
|
pd_id: { type: DataTypes.INTEGER },
|
||||||
|
client_info_available: { type: DataTypes.STRING },
|
||||||
|
client_not_available_reason: { type: DataTypes.STRING },
|
||||||
|
provider_name: { type: DataTypes.STRING },
|
||||||
|
client_name: { type: DataTypes.INTEGER },
|
||||||
|
contact_person_name: { type: DataTypes.STRING },
|
||||||
|
contact_person_designation: { type: DataTypes.STRING },
|
||||||
|
contact_person_mobile_no: { type: DataTypes.INTEGER },
|
||||||
|
person_stdcode: { type: DataTypes.INTEGER },
|
||||||
|
person_landline: { type: DataTypes.INTEGER },
|
||||||
|
payment_type: { type: DataTypes.STRING },
|
||||||
|
credit_period_no: { type: DataTypes.INTEGER },
|
||||||
|
credit_total_purchase: { type: DataTypes.INTEGER },
|
||||||
|
payment_mode: { type: DataTypes.STRING },
|
||||||
|
company_name: { type: DataTypes.STRING },
|
||||||
|
common_remarks: { type: DataTypes.STRING },
|
||||||
|
createdby: { type: DataTypes.INTEGER },
|
||||||
|
updatedby: { type: DataTypes.INTEGER }
|
||||||
|
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sequelize,
|
||||||
|
tableName: 'credit_clients_details',
|
||||||
|
modelName: 'ClientDetail',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
return ClientDetail
|
||||||
|
}
|
||||||
32
app/models/Covid19Questions.js
Normal file
32
app/models/Covid19Questions.js
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
'use strict'
|
||||||
|
const { Model } = require('sequelize')
|
||||||
|
module.exports = (sequelize, DataTypes) => {
|
||||||
|
class Covid19Questions extends Model {
|
||||||
|
|
||||||
|
}
|
||||||
|
Covid19Questions.init(
|
||||||
|
{
|
||||||
|
pd_id: { type: DataTypes.INTEGER },
|
||||||
|
business_impacted_by_covid19: { type: DataTypes.STRING },
|
||||||
|
business_impacted_by_covid19_Yes: { type: DataTypes.STRING },
|
||||||
|
business_impacted_by_covid19_No: { type: DataTypes.STRING },
|
||||||
|
avail_loan_moratorium_facility: { type: DataTypes.STRING },
|
||||||
|
avail_any_loan: { type: DataTypes.STRING },
|
||||||
|
avail_any_loan_Yes: { type: DataTypes.STRING },
|
||||||
|
sales_or_revenue_amt: { type: DataTypes.STRING },
|
||||||
|
mentioned_turover_validated: { type: DataTypes.STRING },
|
||||||
|
mentioned_turover_validated_Yes: { type: DataTypes.STRING },
|
||||||
|
createdby: { type: DataTypes.INTEGER },
|
||||||
|
updatedby: { type: DataTypes.INTEGER }
|
||||||
|
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sequelize,
|
||||||
|
tableName: 'credit_covid_19_questions',
|
||||||
|
modelName: 'Covid19Questions',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
return Covid19Questions
|
||||||
|
}
|
||||||
36
app/models/CreditAddressDetail.js
Normal file
36
app/models/CreditAddressDetail.js
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
'use strict'
|
||||||
|
const { Model } = require('sequelize')
|
||||||
|
module.exports = (sequelize, DataTypes) => {
|
||||||
|
class CreditAddressDetail extends Model {
|
||||||
|
|
||||||
|
}
|
||||||
|
CreditAddressDetail.init(
|
||||||
|
{
|
||||||
|
pd_id: { type: DataTypes.INTEGER },
|
||||||
|
initiated_address: { type: DataTypes.STRING },
|
||||||
|
is_pd_done_on_initiated_address: { type: DataTypes.STRING },
|
||||||
|
alternative_address: { type: DataTypes.STRING },
|
||||||
|
address_type: { type: DataTypes.STRING },
|
||||||
|
address_type_others: { type: DataTypes.STRING },
|
||||||
|
pd_locality: { type: DataTypes.STRING },
|
||||||
|
locality_other: { type: DataTypes.STRING },
|
||||||
|
pd_location: { type: DataTypes.STRING },
|
||||||
|
comment_locality: { type: DataTypes.STRING },
|
||||||
|
business_estimated_area: { type: DataTypes.INTEGER },
|
||||||
|
uom: { type: DataTypes.STRING },
|
||||||
|
uom_specify: { type: DataTypes.STRING },
|
||||||
|
common_remarks: { type: DataTypes.STRING },
|
||||||
|
createdby: { type: DataTypes.INTEGER },
|
||||||
|
updatedby: { type: DataTypes.INTEGER }
|
||||||
|
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sequelize,
|
||||||
|
tableName: 'credit_address_details',
|
||||||
|
modelName: 'CreditAddressDetail',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
return CreditAddressDetail
|
||||||
|
}
|
||||||
34
app/models/CreditBorrowerAndGuarantorDetails.js
Normal file
34
app/models/CreditBorrowerAndGuarantorDetails.js
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
'use strict'
|
||||||
|
const { Model } = require('sequelize')
|
||||||
|
module.exports = (sequelize, DataTypes) => {
|
||||||
|
class CreditBorrowerAndGuarantorDetails extends Model {
|
||||||
|
|
||||||
|
}
|
||||||
|
CreditBorrowerAndGuarantorDetails.init(
|
||||||
|
{
|
||||||
|
pd_id: { type: DataTypes.INTEGER },
|
||||||
|
borrower_type: { type: DataTypes.STRING },
|
||||||
|
numbers_of_years_business_running: { type: DataTypes.INTEGER },
|
||||||
|
borrower_name: { type: DataTypes.STRING },
|
||||||
|
mobile_no: { type: DataTypes.INTEGER },
|
||||||
|
entity_type: { type: DataTypes.STRING },
|
||||||
|
borrower_age: { type: DataTypes.INTEGER },
|
||||||
|
borrower_met: { type: DataTypes.STRING },
|
||||||
|
designation: { type: DataTypes.STRING },
|
||||||
|
relationship_to: { type: DataTypes.STRING },
|
||||||
|
relationship: { type: DataTypes.STRING },
|
||||||
|
common_remarks: { type: DataTypes.STRING },
|
||||||
|
createdby: { type: DataTypes.INTEGER },
|
||||||
|
updatedby: { type: DataTypes.INTEGER }
|
||||||
|
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sequelize,
|
||||||
|
tableName: 'credit_borrower_and_guarantor_details',
|
||||||
|
modelName: 'CreditBorrowerAndGuarantorDetails',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
return CreditBorrowerAndGuarantorDetails
|
||||||
|
}
|
||||||
28
app/models/CreditBusinessAndPersonalBankingDetails.js
Normal file
28
app/models/CreditBusinessAndPersonalBankingDetails.js
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
'use strict'
|
||||||
|
const { Model } = require('sequelize')
|
||||||
|
module.exports = (sequelize, DataTypes) => {
|
||||||
|
class CreditBusinessAndPersonalBankingDetails extends Model {
|
||||||
|
|
||||||
|
}
|
||||||
|
CreditBusinessAndPersonalBankingDetails.init(
|
||||||
|
{
|
||||||
|
pd_id: { type: DataTypes.INTEGER },
|
||||||
|
applicant_name: { type: DataTypes.STRING },
|
||||||
|
bank_name: { type: DataTypes.STRING },
|
||||||
|
account_type: { type: DataTypes.STRING },
|
||||||
|
cc_limit: { type: DataTypes.STRING },
|
||||||
|
common_remarks: { type: DataTypes.STRING },
|
||||||
|
createdby: { type: DataTypes.INTEGER },
|
||||||
|
updatedby: { type: DataTypes.INTEGER }
|
||||||
|
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sequelize,
|
||||||
|
tableName: 'credit_business_and_personal_banking_details',
|
||||||
|
modelName: 'CreditBusinessAndPersonalBankingDetails',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
return CreditBusinessAndPersonalBankingDetails
|
||||||
|
}
|
||||||
33
app/models/CreditExistingLoanOblogation.js
Normal file
33
app/models/CreditExistingLoanOblogation.js
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
'use strict'
|
||||||
|
const { Model } = require('sequelize')
|
||||||
|
module.exports = (sequelize, DataTypes) => {
|
||||||
|
class CreditExistingLoanObligation extends Model {
|
||||||
|
|
||||||
|
}
|
||||||
|
CreditExistingLoanObligation.init(
|
||||||
|
{
|
||||||
|
pd_id: { type: DataTypes.INTEGER },
|
||||||
|
loan_type: { type: DataTypes.INTEGER },
|
||||||
|
loan_amount: { type: DataTypes.INTEGER },
|
||||||
|
lender_name: { type: DataTypes.STRING },
|
||||||
|
loan_taken_by: { type: DataTypes.STRING },
|
||||||
|
instalment_amount: { type: DataTypes.INTEGER },
|
||||||
|
instalment_frequency: { type: DataTypes.STRING },
|
||||||
|
original_tenure_months: { type: DataTypes.INTEGER },
|
||||||
|
current_tenure_months: { type: DataTypes.INTEGER },
|
||||||
|
elapsed_tenure_months: { type: DataTypes.INTEGER },
|
||||||
|
common_remarks: { type: DataTypes.STRING },
|
||||||
|
createdby: { type: DataTypes.INTEGER },
|
||||||
|
updatedby: { type: DataTypes.INTEGER }
|
||||||
|
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sequelize,
|
||||||
|
tableName: 'credit_existing_loan_obligations',
|
||||||
|
modelName: 'CreditExistingLoanObligation',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
return CreditExistingLoanObligation
|
||||||
|
}
|
||||||
30
app/models/CreditFinalRemarks.js
Normal file
30
app/models/CreditFinalRemarks.js
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
'use strict'
|
||||||
|
const { Model } = require('sequelize')
|
||||||
|
module.exports = (sequelize, DataTypes) => {
|
||||||
|
class CreditFinalRemarks extends Model {
|
||||||
|
|
||||||
|
}
|
||||||
|
CreditFinalRemarks.init(
|
||||||
|
{
|
||||||
|
pd_id: { type: DataTypes.INTEGER },
|
||||||
|
customer_behaviour: { type: DataTypes.STRING },
|
||||||
|
customer_behaviour_other: { type: DataTypes.STRING },
|
||||||
|
business_location_suited: { type: DataTypes.STRING },
|
||||||
|
pd_officer_recommendation: { type: DataTypes.STRING },
|
||||||
|
pd_officer_recommendation_other: { type: DataTypes.STRING },
|
||||||
|
reason: { type: DataTypes.STRING },
|
||||||
|
final_form_remarks: { type: DataTypes.STRING },
|
||||||
|
createdby: { type: DataTypes.INTEGER },
|
||||||
|
updatedby: { type: DataTypes.INTEGER }
|
||||||
|
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sequelize,
|
||||||
|
tableName: 'credit_final_remarks',
|
||||||
|
modelName: 'CreditFinalRemarks',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
return CreditFinalRemarks
|
||||||
|
}
|
||||||
35
app/models/CreditFinancialAnalysis.js
Normal file
35
app/models/CreditFinancialAnalysis.js
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
'use strict'
|
||||||
|
const { Model } = require('sequelize')
|
||||||
|
module.exports = (sequelize, DataTypes) => {
|
||||||
|
class CreditFinancialAnalysis extends Model {
|
||||||
|
|
||||||
|
}
|
||||||
|
CreditFinancialAnalysis.init(
|
||||||
|
{
|
||||||
|
pd_id: { type: DataTypes.INTEGER },
|
||||||
|
car_type: { type: DataTypes.STRING },
|
||||||
|
leverage: { type: DataTypes.STRING },
|
||||||
|
alm: { type: DataTypes.STRING },
|
||||||
|
opex: { type: DataTypes.STRING },
|
||||||
|
nim: { type: DataTypes.STRING },
|
||||||
|
opex_average: { type: DataTypes.STRING },
|
||||||
|
opex_nii: { type: DataTypes.STRING },
|
||||||
|
return_asset: { type: DataTypes.STRING },
|
||||||
|
return_equity: { type: DataTypes.STRING },
|
||||||
|
irr: { type: DataTypes.STRING },
|
||||||
|
avg_borrowing: { type: DataTypes.STRING },
|
||||||
|
spread: { type: DataTypes.STRING },
|
||||||
|
createdby: { type: DataTypes.INTEGER },
|
||||||
|
updatedby: { type: DataTypes.INTEGER }
|
||||||
|
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sequelize,
|
||||||
|
tableName: 'credit_financial_analysis',
|
||||||
|
modelName: 'CreditFinancialAnalysis',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
return CreditFinancialAnalysis
|
||||||
|
}
|
||||||
53
app/models/CreditFinancialInformation.js
Normal file
53
app/models/CreditFinancialInformation.js
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
'use strict'
|
||||||
|
const { Model } = require('sequelize')
|
||||||
|
module.exports = (sequelize, DataTypes) => {
|
||||||
|
class CreditFinancialInformation extends Model {
|
||||||
|
|
||||||
|
}
|
||||||
|
CreditFinancialInformation.init(
|
||||||
|
{
|
||||||
|
pd_id: { type: DataTypes.INTEGER },
|
||||||
|
financial_info_available: { type: DataTypes.STRING },
|
||||||
|
net_profit_rs: { type: DataTypes.INTEGER },
|
||||||
|
net_profit_to_sales_percent: { type: DataTypes.STRING },
|
||||||
|
sales_amount: { type: DataTypes.INTEGER },
|
||||||
|
is_any_other_working_captial_facility: { type: DataTypes.STRING },
|
||||||
|
facility_details_specify: { type: DataTypes.STRING },
|
||||||
|
facility_details_other_lender: { type: DataTypes.STRING },
|
||||||
|
facility_details_other: { type: DataTypes.STRING },
|
||||||
|
broken_period_turnover_percent: { type: DataTypes.INTEGER },
|
||||||
|
broken_period_turnover_py: { type: DataTypes.STRING },
|
||||||
|
broken_period_turnover_cy: { type: DataTypes.STRING },
|
||||||
|
broken_period_no_of_months: { type: DataTypes.INTEGER },
|
||||||
|
broken_period_to_month: { type: DataTypes.DATE },
|
||||||
|
broken_period_from_month: { type: DataTypes.DATE },
|
||||||
|
inventory_days_cm: { type: DataTypes.INTEGER },
|
||||||
|
creditor_days_cm: { type: DataTypes.INTEGER },
|
||||||
|
debtor_days_cm: { type: DataTypes.INTEGER },
|
||||||
|
fy: { type: DataTypes.STRING },
|
||||||
|
sales_revenue: { type: DataTypes.STRING },
|
||||||
|
net_profit: { type: DataTypes.STRING },
|
||||||
|
net_profit_sales_percent: { type: DataTypes.STRING },
|
||||||
|
sales_py: { type: DataTypes.INTEGER },
|
||||||
|
netprofit_py: { type: DataTypes.INTEGER },
|
||||||
|
netprofit_py_percent: { type: DataTypes.INTEGER },
|
||||||
|
debtor_days_cet: { type: DataTypes.INTEGER },
|
||||||
|
creditor_days_cet: { type: DataTypes.INTEGER },
|
||||||
|
inventory_days_cet: { type: DataTypes.INTEGER },
|
||||||
|
company_name: { type: DataTypes.STRING },
|
||||||
|
no_of_financial_years: { type: DataTypes.INTEGER },
|
||||||
|
common_remarks: { type: DataTypes.STRING },
|
||||||
|
createdby: { type: DataTypes.INTEGER },
|
||||||
|
updatedby: { type: DataTypes.INTEGER }
|
||||||
|
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sequelize,
|
||||||
|
tableName: 'credit_financial_information',
|
||||||
|
modelName: 'CreditFinancialInformation',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
return CreditFinancialInformation
|
||||||
|
}
|
||||||
29
app/models/CreditFuturePlans.js
Normal file
29
app/models/CreditFuturePlans.js
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
'use strict'
|
||||||
|
const { Model } = require('sequelize')
|
||||||
|
module.exports = (sequelize, DataTypes) => {
|
||||||
|
class CreditFuturePlans extends Model {
|
||||||
|
|
||||||
|
}
|
||||||
|
CreditFuturePlans.init(
|
||||||
|
{
|
||||||
|
pd_id: { type: DataTypes.INTEGER },
|
||||||
|
usp_of_business: { type: DataTypes.STRING },
|
||||||
|
future_business_expansion: { type: DataTypes.STRING },
|
||||||
|
key_competitors: { type: DataTypes.STRING },
|
||||||
|
sucession_plan: { type: DataTypes.STRING },
|
||||||
|
other_group_business_applicants: { type: DataTypes.STRING },
|
||||||
|
common_remarks: { type: DataTypes.STRING },
|
||||||
|
createdby: { type: DataTypes.INTEGER },
|
||||||
|
updatedby: { type: DataTypes.INTEGER }
|
||||||
|
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sequelize,
|
||||||
|
tableName: 'credit_future_plans_and_business_environments',
|
||||||
|
modelName: 'CreditFuturePlans',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
return CreditFuturePlans
|
||||||
|
}
|
||||||
31
app/models/CreditGeneralBusinessInformation.js
Normal file
31
app/models/CreditGeneralBusinessInformation.js
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
'use strict'
|
||||||
|
const { Model } = require('sequelize')
|
||||||
|
module.exports = (sequelize, DataTypes) => {
|
||||||
|
class CreditGeneralBusinessInformation extends Model {
|
||||||
|
|
||||||
|
}
|
||||||
|
CreditGeneralBusinessInformation.init(
|
||||||
|
{
|
||||||
|
pd_id: { type: DataTypes.INTEGER },
|
||||||
|
company_name: { type: DataTypes.STRING },
|
||||||
|
business_entity_type: { type: DataTypes.STRING },
|
||||||
|
select_business_activity_type: { type: DataTypes.STRING },
|
||||||
|
area_of_sale: { type: DataTypes.STRING },
|
||||||
|
seasonality: { type: DataTypes.STRING },
|
||||||
|
low_sale_month_reason: { type: DataTypes.STRING },
|
||||||
|
low_sale_month: { type: DataTypes.STRING },
|
||||||
|
common_remarks: { type: DataTypes.STRING },
|
||||||
|
createdby: { type: DataTypes.INTEGER },
|
||||||
|
updatedby: { type: DataTypes.INTEGER }
|
||||||
|
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sequelize,
|
||||||
|
tableName: 'credit_general_business_information',
|
||||||
|
modelName: 'CreditGeneralBusinessInformation',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
return CreditGeneralBusinessInformation
|
||||||
|
}
|
||||||
27
app/models/CreditGeneralInformation.js
Normal file
27
app/models/CreditGeneralInformation.js
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
'use strict'
|
||||||
|
const { Model } = require('sequelize')
|
||||||
|
module.exports = (sequelize, DataTypes) => {
|
||||||
|
class CreditGeneralInformation extends Model {
|
||||||
|
|
||||||
|
}
|
||||||
|
CreditGeneralInformation.init(
|
||||||
|
{
|
||||||
|
pd_id: { type: DataTypes.INTEGER },
|
||||||
|
name: { type: DataTypes.STRING },
|
||||||
|
loan_amount: { type: DataTypes.INTEGER },
|
||||||
|
product: { type: DataTypes.STRING },
|
||||||
|
location: { type: DataTypes.STRING },
|
||||||
|
createdby: { type: DataTypes.INTEGER },
|
||||||
|
updatedby: { type: DataTypes.INTEGER }
|
||||||
|
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sequelize,
|
||||||
|
tableName: 'credit_general_information',
|
||||||
|
modelName: 'CreditGeneralInformation',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
return CreditGeneralInformation
|
||||||
|
}
|
||||||
30
app/models/EmployeeStrength.js
Normal file
30
app/models/EmployeeStrength.js
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
'use strict'
|
||||||
|
const { Model } = require('sequelize')
|
||||||
|
module.exports = (sequelize, DataTypes) => {
|
||||||
|
class EmployeeStrength extends Model {
|
||||||
|
|
||||||
|
}
|
||||||
|
EmployeeStrength.init(
|
||||||
|
{
|
||||||
|
pd_id: { type: DataTypes.INTEGER },
|
||||||
|
permanant_employees_person_met: { type: DataTypes.INTEGER },
|
||||||
|
temporary_employees_person_met: { type: DataTypes.INTEGER },
|
||||||
|
permanant_employees_cm: { type: DataTypes.INTEGER },
|
||||||
|
temporary_employees_cm: { type: DataTypes.INTEGER },
|
||||||
|
permanant_employees_salary: { type: DataTypes.INTEGER },
|
||||||
|
temporary_employees_salary: { type: DataTypes.INTEGER },
|
||||||
|
common_remarks: { type: DataTypes.STRING },
|
||||||
|
createdby: { type: DataTypes.INTEGER },
|
||||||
|
updatedby: { type: DataTypes.INTEGER }
|
||||||
|
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sequelize,
|
||||||
|
tableName: 'credit_employee_strength',
|
||||||
|
modelName: 'EmployeeStrength',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
return EmployeeStrength
|
||||||
|
}
|
||||||
31
app/models/FamilyMemberInvolvedInBusiness.js
Normal file
31
app/models/FamilyMemberInvolvedInBusiness.js
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
'use strict'
|
||||||
|
const { Model } = require('sequelize')
|
||||||
|
module.exports = (sequelize, DataTypes) => {
|
||||||
|
class FamilyMemberInvolvedInBusiness extends Model {
|
||||||
|
|
||||||
|
}
|
||||||
|
FamilyMemberInvolvedInBusiness.init(
|
||||||
|
{
|
||||||
|
pd_id: { type: DataTypes.INTEGER },
|
||||||
|
is_family_details_available: { type: DataTypes.STRING },
|
||||||
|
member_name: { type: DataTypes.STRING },
|
||||||
|
relationship: { type: DataTypes.STRING },
|
||||||
|
relationship_other: { type: DataTypes.STRING },
|
||||||
|
stakeholder_relation: { type: DataTypes.STRING },
|
||||||
|
company_relation: { type: DataTypes.STRING },
|
||||||
|
started_biz: { type: DataTypes.STRING },
|
||||||
|
common_remarks: { type: DataTypes.STRING },
|
||||||
|
createdby: { type: DataTypes.INTEGER },
|
||||||
|
updatedby: { type: DataTypes.INTEGER }
|
||||||
|
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sequelize,
|
||||||
|
tableName: 'credit_family_members_involved_in_business',
|
||||||
|
modelName: 'FamilyMemberInvolvedInBusiness',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
return FamilyMemberInvolvedInBusiness
|
||||||
|
}
|
||||||
29
app/models/FinalRemarks.js
Normal file
29
app/models/FinalRemarks.js
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
'use strict'
|
||||||
|
const { Model } = require('sequelize')
|
||||||
|
module.exports = (sequelize, DataTypes) => {
|
||||||
|
class FinalRemarks extends Model {
|
||||||
|
|
||||||
|
}
|
||||||
|
FinalRemarks.init(
|
||||||
|
{
|
||||||
|
pd_id: { type: DataTypes.INTEGER },
|
||||||
|
business_activity_seen: { type: DataTypes.STRING },
|
||||||
|
location_workplace_suits_business: { type: DataTypes.STRING },
|
||||||
|
overall_assessment: { type: DataTypes.STRING },
|
||||||
|
recommended_roi: { type: DataTypes.INTEGER },
|
||||||
|
future_business_expansion_plans: { type: DataTypes.STRING },
|
||||||
|
any_other_remarks: { type: DataTypes.STRING },
|
||||||
|
behaviour_call: { type: DataTypes.STRING },
|
||||||
|
createdby: { type: DataTypes.INTEGER },
|
||||||
|
updatedby: { type: DataTypes.INTEGER }
|
||||||
|
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sequelize,
|
||||||
|
tableName: 'sales_final_remarks_of_pd_officer',
|
||||||
|
modelName: 'FinalRemarks',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
return FinalRemarks
|
||||||
|
}
|
||||||
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;
|
||||||
32
app/routes/routes.js
Normal file
32
app/routes/routes.js
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
module.exports = app => {
|
||||||
|
const request = require("request");
|
||||||
|
const cors=require('cors');
|
||||||
|
const Mycontroller = require("../controllers/test.controller.js");
|
||||||
|
const { logMsg } = require('../services/logger.js');
|
||||||
|
var router = require("express").Router();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @swagger
|
||||||
|
* /api/demo:
|
||||||
|
* get:
|
||||||
|
* summary: Demo Api
|
||||||
|
* description: Welcome Message
|
||||||
|
* responses:
|
||||||
|
* 200:
|
||||||
|
* description: success
|
||||||
|
*/
|
||||||
|
router.get("/demo", Mycontroller.Welcome);
|
||||||
|
|
||||||
|
|
||||||
|
router.get('/salespd',Mycontroller.SalesPd)
|
||||||
|
|
||||||
|
|
||||||
|
// 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,
|
||||||
|
};
|
||||||
|
|
||||||
8798
package-lock.json
generated
Normal file
8798
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
30
package.json
Normal file
30
package.json
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
"name": "smc_cet_creditpd_backend",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"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",
|
||||||
|
"lodash": "^4.17.21",
|
||||||
|
"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"
|
||||||
|
},
|
||||||
|
"description": ""
|
||||||
|
}
|
||||||
63
server.js
Normal file
63
server.js
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
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:8080')
|
||||||
|
|
||||||
|
//await sequelize.authenticate()
|
||||||
|
})
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user