Surya: test
This commit is contained in:
parent
17a2157483
commit
8381e7830e
@ -1,4 +1,5 @@
|
||||
|
||||
const { response } = require('express');
|
||||
const { sequelize, Entities , Financials , Statementsmaster , Sectionsmaster , Subsectionsmaster , Brokenperiods , Entityfinyears } = require('../models')
|
||||
const { logMsg } = require('../services/logger.js');
|
||||
|
||||
@ -250,15 +251,19 @@ exports.test = (req, res) => {
|
||||
|
||||
|
||||
|
||||
exports.test2 = (req, res) => {
|
||||
exports.test2 = async (req, res) => {
|
||||
const losid = req.query.losid
|
||||
const promise = Promise.resolve(res.send({'losid':losid,'status':200,'message':"success"}));
|
||||
const p1 = losid => new Promise((resolve,reject) =>{
|
||||
//console.log(losid)
|
||||
resolve(losid)
|
||||
})
|
||||
p1(1).then((losid) => {
|
||||
|
||||
// const promise = Promise.resolve(res.send({'losid':losid,'status':200,'message':"success"}));
|
||||
var promise = (losid) => new Promise((resolve,reject) =>{
|
||||
resolve(losid)
|
||||
|
||||
|
||||
})
|
||||
// p1(losid).then((losid) => {
|
||||
|
||||
promise(losid).then((losid) => {
|
||||
console.log(losid)
|
||||
//pro 42 api call using losid
|
||||
const Pro42Data = [
|
||||
{"losid":losid,"pan":"AA1234AAAA","cin":"test1_cin","bizname":"test1_bizname","entity_type":"type","activity_group":"grp","biz_act_desc":"des","createdby":4},
|
||||
@ -323,16 +328,23 @@ exports.test = (req, res) => {
|
||||
|
||||
} //end of else condition
|
||||
|
||||
}); // end of (losid,pan,cin) combination checking entity data exist or not
|
||||
}) // end of (losid,pan,cin) combination checking entity data exist or not
|
||||
|
||||
}); // end of pro42 data foreach
|
||||
}) // end of pro42 data foreach
|
||||
|
||||
return ({'losid':losid,'status':200,'message':"success",'data':"No data"}); // success message
|
||||
//end of try catch
|
||||
|
||||
})
|
||||
.then((value) => {
|
||||
|
||||
})
|
||||
// await sleep(2000)
|
||||
//promise.then(function(value){
|
||||
//.then((value) => {
|
||||
.then(function(value){
|
||||
// writeToBody(topic);
|
||||
console.log(value)
|
||||
setTimeout(function(){
|
||||
console.log(value)
|
||||
try {
|
||||
|
||||
if(value.status == 200)
|
||||
@ -354,20 +366,23 @@ exports.test = (req, res) => {
|
||||
}],
|
||||
required :false
|
||||
})
|
||||
.then(MasterData => {
|
||||
.then(MasterData =>
|
||||
{
|
||||
//setTimeout(
|
||||
Entities.findAll({where : { losid } , attributes: ['id', 'losid' , 'pan' , 'cin' , 'bizname' , 'entity_type' , 'activity_group' , 'biz_act_desc' ] })
|
||||
// ,2000)
|
||||
.then(EntitiesData => {
|
||||
console.log(EntitiesData)
|
||||
let data = [];
|
||||
EntitiesData.forEach((value, key)=>{
|
||||
obj_data = { ...value.dataValues , statementsmasterrData:MasterData }
|
||||
|
||||
data.push(obj_data);
|
||||
}) // end of EntitiesData foreach
|
||||
}); // end of EntitiesData foreach
|
||||
console.log(data)
|
||||
console.log('4')
|
||||
logMsg.info("MenuList api working");
|
||||
|
||||
return ({'status':200,'message':"success",'data':data});
|
||||
logMsg.info("MenuList api working")
|
||||
Promise.resolve(res.send({'losid':losid,'status':200,'message':"success",'data':data}))
|
||||
return (data);
|
||||
}); // end of findall EntitiesData
|
||||
}); // end of findall masters datas
|
||||
} // end of starter function if condition
|
||||
@ -375,13 +390,24 @@ exports.test = (req, res) => {
|
||||
}
|
||||
|
||||
catch (err) {
|
||||
console.log(err)
|
||||
return res.status(500).json({'status':404,'message':"failed",'data':"No data"})
|
||||
console.log
|
||||
}
|
||||
},1000);
|
||||
})
|
||||
// .then((value) =>{
|
||||
// console.log(value)
|
||||
// console.log('last')
|
||||
|
||||
}).catch(console.log)
|
||||
// resolve(res.send({'losid':losid,'status':200,'message':"success",'data':value}))
|
||||
|
||||
// })
|
||||
// Promise.all([promise]).then(value => {
|
||||
// console.log(value)
|
||||
// console.log('last')
|
||||
// resolve(res.send({'losid':losid,'status':200,'message':"success",'data':value}))
|
||||
// })
|
||||
|
||||
.catch(console.log)
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -233,6 +233,10 @@ module.exports = app => {
|
||||
* type: integer
|
||||
* description: Third Year statement type
|
||||
* example: 1
|
||||
* Y4_st_type:
|
||||
* type: integer
|
||||
* description: fourth Year statement type
|
||||
* example: 1 or null
|
||||
* updatedby:
|
||||
* type: integer
|
||||
* description: The person who modified
|
||||
@ -815,9 +819,6 @@ module.exports = app => {
|
||||
*/
|
||||
router.get("/Historyapi", master.Historyapi);
|
||||
|
||||
// router.get("/printAll", test.printAll);
|
||||
router.get("/test", test.test);
|
||||
router.get("/test1", test.test1);
|
||||
router.get("/test2", test.test2);
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user