diff --git a/app/controllers/financial.controller.js b/app/controllers/financial.controller.js index 49421e2..9d9e417 100644 --- a/app/controllers/financial.controller.js +++ b/app/controllers/financial.controller.js @@ -37,7 +37,7 @@ exports.MenuList = async (req, res) => { //findAll({ where :{is_active : 1} ,include : { association: 'sectionsmasterData' } }); //findAll({ where :{is_active : 1} , include: { all: true, nested: true , where :{is_active : 1} }}); try { - const losid = req.params.losid + const losid = req.query.losid const MasterData = await Statementsmaster.findAll({ where :{is_active : 1} , attributes: ['id', 'statement', 'is_active'], @@ -81,7 +81,7 @@ exports.MenuList = async (req, res) => { // FinantialsSummary exports.FinantialsSummary = async (req, res) => { - const id = req.params.id + const id = req.query.entityid Financials.findAll({where : { entity_id : id } ,attributes: ['fy'], group: ['fy'] , order: [['fy', 'DESC']] }) .then(data => { @@ -113,11 +113,11 @@ exports.FinantialsSummary = async (req, res) => { // Broken period list api exports.BrokenPeriodsList = (req, res) => { - const entityid = req.params.entityid + const entityid = req.query.entityid try { Brokenperiods.findOne({where : { entity_id : entityid } }) .then(data => { - console.log(data); + if(data) {res.send({'status':200,'message':"success",'data':data});} else{res.send({'status':404,'message':"failed",'data':"nodata"});} diff --git a/app/models/Brokenperiods.js b/app/models/Brokenperiods.js index 63344dc..d89755c 100644 --- a/app/models/Brokenperiods.js +++ b/app/models/Brokenperiods.js @@ -22,7 +22,7 @@ module.exports = (sequelize, DataTypes) => { months: { type: DataTypes.INTEGER }, cy: { type: DataTypes.INTEGER }, py: { type: DataTypes.INTEGER }, - variation: { type: DataTypes.INTEGER }, + variation: { type: DataTypes.STRING }, createdby: { type: DataTypes.INTEGER }, updatedby: { type: DataTypes.INTEGER }, diff --git a/app/routes/routes.js b/app/routes/routes.js index 1e697bd..1c8fe10 100644 --- a/app/routes/routes.js +++ b/app/routes/routes.js @@ -20,13 +20,13 @@ module.exports = app => { router.post("/BrokenPeriods", financials.BrokenPeriods); // get financials summary - router.get("/FinantialsSummary/:id", financials.FinantialsSummary); + router.get("/FinantialsSummary", financials.FinantialsSummary); // get menu list - router.get("/MenuList/:losid", financials.MenuList); + router.get("/MenuList", financials.MenuList); // Retrieve all Broken periods - router.get("/BrokenPeriodsList/:entityid", financials.BrokenPeriodsList); + router.get("/BrokenPeriodsList", financials.BrokenPeriodsList); // fetching all master data router.get("/MasterDatas", financials.MasterDatas); @@ -36,7 +36,7 @@ module.exports = app => { // update financials data router.post("/updateFinancials", financials.updateFinancials); - //router.get("/test", financials.test); +