masterdata:GWM

This commit is contained in:
sriramv 2021-08-21 16:06:10 +05:30
parent d6d5d75a67
commit 99b74dd318
2 changed files with 34 additions and 2 deletions

View File

@ -1,8 +1,36 @@
const { sequelize, Entities , Financials , Statementsmaster , Sectionsmaster , Subsectionsmaster , Brokenperiods } = require('../models') const { sequelize, Entities , Financials , Statementsmaster , Sectionsmaster , Subsectionsmaster , Brokenperiods } = require('../models')
const { logMsg } = require('../services/logger.js'); const { logMsg } = require('../services/logger.js');
// all master data list
exports.MasterDatas = async (req, res) => {
await Statementsmaster.findAll({
where :{is_active : 1} ,
attributes: ['id', 'statement', 'is_active'],
include :[{
association: 'sectionsmasterData' ,
where :{is_active : 1} ,
attributes: ['id', 'section', 'is_active'],
include :[{
association: 'subsectionsmasterData' ,
where :{is_active : 1} ,
attributes: ['id', 'subsection', 'is_active'],
required :false
}],
required :false
}],
required :false
})
.then(data =>
{
res.send({'status':200,'message':"success",'data':data});
logMsg.info("Master Data List api call Success");
})
.catch(err => {
res.status(404).send({'status':404,
message: err.message || "Some error occurred while retrieving statements." ,'data': "No data" });
});
};
// menu list api // menu list api
exports.MenuList = async (req, res) => { exports.MenuList = async (req, res) => {
@ -35,7 +63,8 @@ exports.MenuList = async (req, res) => {
obj_data = { ...value.dataValues , statementsmasterrData:MasterData} obj_data = { ...value.dataValues , statementsmasterrData:MasterData}
data.push(obj_data); data.push(obj_data);
}); });
return res.send({'status':200,'message':"success",'data':data}); res.send({'status':200,'message':"success",'data':data});
logMsg.info("MenuList api working");
} catch (err) { } catch (err) {
console.log(err) console.log(err)
return res.status(500).json({'status':404,'message':"failed",'data':"No data"}) return res.status(500).json({'status':404,'message':"failed",'data':"No data"})

View File

@ -26,6 +26,9 @@ module.exports = app => {
// Retrieve all Broken periods // Retrieve all Broken periods
router.get("/BrokenPeriodsList/:entityid", financials.BrokenPeriodsList); router.get("/BrokenPeriodsList/:entityid", financials.BrokenPeriodsList);
// fetchind all master data
router.get("/MasterDatas", financials.MasterDatas);
//master.controller api's //master.controller api's
// get statment master data // get statment master data