301 lines
13 KiB
JavaScript
301 lines
13 KiB
JavaScript
const { sequelize,EntityApplicantMaster,StateMaster,CityMaster,PinMaster,ChecktypeCheckresultRelationMaster,DueDiligenceCheck,CheckResultMaster,CheckTypeMaster,LoanAndLtvMaster , ATNWrelatedInputMaster ,ATNWrelatedInputMasterValues ,ATNWrelatedInputs, ATNWrelationship , OtherParameterMaster ,OtherParameterMasterValue , OtherParameterRelationship} = require('../models')
|
|
const { logMsg } = require('../services/logger.js');
|
|
|
|
|
|
// select entityMaster data
|
|
exports.EntityApplicantMasterData = async (req, res) =>
|
|
{
|
|
try
|
|
{
|
|
await EntityApplicantMaster.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 entity applicant masterdata." ,'data': "No data" });
|
|
});
|
|
|
|
} catch(err) {
|
|
res.send({'status':404,
|
|
message: err.message || "Some error occurred while fetching entity applicant masterdata." ,'data': "No data"
|
|
});
|
|
} //end of try catch
|
|
|
|
};
|
|
|
|
// create entity master data
|
|
exports.CreateEntityApplicantMasterData = async (req, res) =>
|
|
{
|
|
try
|
|
{
|
|
await EntityApplicantMaster.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 entity applicant masterdata." ,'data': "No data" });
|
|
});
|
|
|
|
} catch(err) {
|
|
res.send({'status':404,
|
|
message: err.message || "Some error occurred while create entity applicant masterdata." ,'data': "No data"
|
|
});
|
|
} //end of try catch
|
|
};
|
|
|
|
|
|
// select state master data
|
|
exports.StateMasterData = async (req, res) =>
|
|
{
|
|
try
|
|
{
|
|
await StateMaster.findAll({ where : {"is_active" : 1}})
|
|
.then(data =>
|
|
{
|
|
res.send({'status':200,'message':"success",'data':data});
|
|
|
|
})
|
|
.catch(err => {
|
|
res.send({'status':404,
|
|
message: err.message || "Some error occurred while fetching state masterdata." ,'data': "No data" });
|
|
});
|
|
|
|
} catch(err) {
|
|
res.send({'status':404,
|
|
message: err.message || "Some error occurred while fetching state masterdata." ,'data': "No data"
|
|
});
|
|
} //end of try catch
|
|
|
|
};
|
|
|
|
// select city master data
|
|
exports.CityMasterData = async (req, res) =>
|
|
{
|
|
try
|
|
{
|
|
await CityMaster.findAll({ where : { "state_id" : req.query.state_id , "is_active" : 1 }})
|
|
.then(data =>
|
|
{
|
|
res.send({'status':200,'message':"success",'data':data });
|
|
|
|
})
|
|
.catch(err => {
|
|
res.send({'status':404,
|
|
message: err.message || "Some error occurred while fetching city masterdata." ,'data': "No data" });
|
|
});
|
|
|
|
} catch(err) {
|
|
res.send({'status':404,
|
|
message: err.message || "Some error occurred while fetching city masterdata." ,'data': "No data"
|
|
});
|
|
} //end of try catch
|
|
|
|
};
|
|
|
|
// select pin master data
|
|
exports.PinMasterData = async (req, res) =>
|
|
{
|
|
try
|
|
{
|
|
await PinMaster.findAll({ where : { "state_id" : req.query.state_id , "is_active" : 1 }})
|
|
.then(data =>
|
|
{
|
|
res.send({'status':200,'message':"success",'data':data});
|
|
|
|
})
|
|
.catch(err => {
|
|
res.send({'status':404,
|
|
message: err.message || "Some error occurred while fetching pin masterdata." ,'data': "No data" });
|
|
});
|
|
|
|
} catch(err) {
|
|
res.send({'status':404,
|
|
message: err.message || "Some error occurred while fetching pin masterdata." ,'data': "No data"
|
|
});
|
|
} //end of try catch
|
|
|
|
};
|
|
|
|
// select checkResultMaster
|
|
exports.CheckResultMaster = async (req, res) =>
|
|
{
|
|
try
|
|
{
|
|
sequelize.query('SELECT checktype_checkresult_relation_master.check_type_id , checktype_checkresult_relation_master.check_result_id, check_type_master.value AS check_type, check_result_master.value AS check_result FROM checktype_checkresult_relation_master JOIN check_type_master ON checktype_checkresult_relation_master.check_type_id = check_type_master.id and check_type_master.is_active = 1JOIN check_result_master ON checktype_checkresult_relation_master.check_result_id = check_result_master.id and check_result_master.is_active = 1 where checktype_checkresult_relation_master.is_active = 1 ')
|
|
.then((data)=> {
|
|
res.send({'status':200,'message':"success",'data':data})
|
|
})
|
|
.catch(err => {
|
|
res.send({'status':404,
|
|
message: err.message || "Some error occurred while fetching check result master data." ,'data': "No data" });
|
|
});
|
|
|
|
} catch(err) {
|
|
res.send({'status':404,
|
|
message: err.message || "Some error occurred while fetching check result master data." ,'data': "No data"
|
|
});
|
|
} //end of try catch
|
|
|
|
|
|
};
|
|
|
|
// create check type master
|
|
exports.CreateCheckTypeMaster = async (req, res) =>
|
|
{
|
|
try
|
|
{
|
|
await CheckTypeMaster.create(req.body)
|
|
.then(data =>
|
|
{
|
|
res.send({'status':200,'message':"success",'data':"success"});
|
|
|
|
})
|
|
.catch(err => {
|
|
res.send({'status':404,
|
|
message: err.message || "Some error occurred while create type masterdata." ,'data': "No data" });
|
|
});
|
|
|
|
} catch(err) {
|
|
res.send({'status':404,
|
|
message: err.message || "Some error occurred while create type masterdata." ,'data': "No data"
|
|
});
|
|
} //end of try catch
|
|
};
|
|
|
|
// create relation master
|
|
exports.CreateRelationMaster = async (req, res) =>
|
|
{
|
|
try
|
|
{
|
|
await ChecktypeCheckresultRelationMaster.create(req.body)
|
|
.then(data =>
|
|
{
|
|
res.send({'status':200,'message':"success",'data':"success"});
|
|
|
|
})
|
|
.catch(err => {
|
|
res.send({'status':404,
|
|
message: err.message || "Some error occurred while create relation masterdata." ,'data': "No data" });
|
|
});
|
|
|
|
} catch(err) {
|
|
res.send({'status':404,
|
|
message: err.message || "Some error occurred while create relation masterdata." ,'data': "No data"
|
|
});
|
|
} //end of try catch
|
|
|
|
|
|
};
|
|
|
|
// select pin master data
|
|
exports.loanAndLtvMaster = async (req, res) =>
|
|
{
|
|
try
|
|
{
|
|
await LoanAndLtvMaster.findAll({ where : { "is_active" : 1 }})
|
|
.then(data =>
|
|
{
|
|
res.send({'status':200,'message':"success",'data':data});
|
|
|
|
})
|
|
.catch(err => {
|
|
res.send({'status':404,
|
|
message: err.message || "Some error occurred while fetching masterdata." ,'data': "No data" });
|
|
});
|
|
|
|
} catch(err) {
|
|
res.send({'status':404,
|
|
message: err.message || "Some error occurred while fetching masterdata." ,'data': "No data"
|
|
});
|
|
} //end of try catch
|
|
|
|
};
|
|
|
|
|
|
|
|
// select atnwRelationMaster
|
|
exports.atnwRelationMaster = async (req, res) =>
|
|
{
|
|
try
|
|
{
|
|
sequelize.query('SELECT atnw_relationship.atnw_master_id , atnw_relationship.atnw_value_id, atnw_related_input_master_name.master_name AS atnw_master_data , atnw_related_input_master_value.value AS atnw_master_value FROM atnw_relationship JOIN atnw_related_input_master_name ON atnw_relationship.atnw_master_id = atnw_related_input_master_name.id and atnw_related_input_master_name.is_active = 1 JOIN atnw_related_input_master_value ON atnw_relationship.atnw_value_id = atnw_related_input_master_value.id and atnw_related_input_master_value.is_active = 1 where atnw_relationship.is_active = 1 ')
|
|
.then((data)=> {
|
|
res.send({'status':200,'message':"success",'data':data})
|
|
})
|
|
.catch(err => {
|
|
res.send({'status':404,
|
|
message: err.message || "Some error occurred while fetching check result master data." ,'data': "No data" });
|
|
});
|
|
|
|
} catch(err) {
|
|
res.send({'status':404,
|
|
message: err.message || "Some error occurred while fetching check result master data." ,'data': "No data"
|
|
});
|
|
} //end of try catch
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// select atnwRelationMaster
|
|
exports.otherParameterMaster = async (req, res) =>
|
|
{
|
|
try
|
|
{
|
|
sequelize.query('SELECT other_parameter_relationship.master_name_id , other_parameter_relationship.master_vaue_id, other_parameter_master.master_name AS other_parameter_master, other_parameter_master_value.value AS other_parameter_master_value FROM other_parameter_relationship JOIN other_parameter_master ON other_parameter_relationship.master_name_id = other_parameter_master.id and other_parameter_master.is_active = 1 JOIN other_parameter_master_value ON other_parameter_relationship.master_vaue_id = other_parameter_master_value.id and other_parameter_master_value.is_active = 1 where other_parameter_relationship.is_active = 1 ')
|
|
.then((data)=> {
|
|
res.send({'status':200,'message':"success",'data':data})
|
|
})
|
|
|
|
.catch(err => {
|
|
res.send({'status':404,
|
|
message: err.message || "Some error occurred while fetching other Parameter Master data." ,'data': "No data" });
|
|
});
|
|
|
|
} catch(err) {
|
|
res.send({'status':404,
|
|
message: err.message || "Some error occurred while fetching other Parameter Master data." ,'data': "No data"
|
|
});
|
|
} //end of try catch
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// // select pin master data
|
|
// exports.PinMasterData = async (req, res) =>
|
|
// {
|
|
// try
|
|
// {
|
|
// await PinMaster.findAll({ where : { "state_id" : req.query.state_id , "is_active" : 1 }})
|
|
// .then(data =>
|
|
// {
|
|
// res.send({'status':200,'message':"success",'data':data});
|
|
|
|
// })
|
|
// .catch(err => {
|
|
// res.send({'status':404,
|
|
// message: err.message || "Some error occurred while fetching pin masterdata." ,'data': "No data" });
|
|
// });
|
|
|
|
// } catch(err) {
|
|
// res.send({'status':404,
|
|
// message: err.message || "Some error occurred while fetching pin masterdata." ,'data': "No data"
|
|
// });
|
|
// } //end of try catch
|
|
|
|
// };
|
|
|
|
|