Surya: statement_type insert api, swagger(newfin yr,st_type insert)
This commit is contained in:
parent
5b6c3b9111
commit
78320a4e71
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,6 +1,7 @@
|
|||||||
/node_modules
|
/node_modules
|
||||||
/storage
|
/storage
|
||||||
.env
|
.env
|
||||||
|
/app/controllers/test.controller.js
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -39,43 +39,46 @@ exports.MenuList = (req, res) => {
|
|||||||
try {
|
try {
|
||||||
const losid = req.query.losid
|
const losid = req.query.losid
|
||||||
// call starter function here
|
// call starter function here
|
||||||
// req_obj ={"losid":losid}
|
console.log(losid)
|
||||||
// starter_response = starter(req_obj);
|
req_obj ={"losid":losid}
|
||||||
// if(starter_response.status == 200)
|
|
||||||
// {
|
starter_response = starter(req_obj);
|
||||||
Statementsmaster.findAll({
|
setTimeout(()=>{
|
||||||
where :{is_active : 1} ,
|
if(starter_response.status == 200)
|
||||||
attributes: ['id', 'statement', 'is_active'],
|
{
|
||||||
include :[{
|
Statementsmaster.findAll({
|
||||||
association: 'sectionsmasterData' ,
|
where :{is_active : 1} ,
|
||||||
where :{is_active : 1} ,
|
attributes: ['id', 'statement', 'is_active'],
|
||||||
attributes: ['id', 'section', 'is_active'],
|
include :[{
|
||||||
include :[{
|
association: 'sectionsmasterData' ,
|
||||||
association: 'subsectionsmasterData' ,
|
where :{is_active : 1} ,
|
||||||
where :{is_active : 1} ,
|
attributes: ['id', 'section', 'is_active'],
|
||||||
attributes: ['id', 'subsection','itemtext', 'is_active'],
|
include :[{
|
||||||
required :false
|
association: 'subsectionsmasterData' ,
|
||||||
}],
|
where :{is_active : 1} ,
|
||||||
required :false
|
attributes: ['id', 'subsection','itemtext', 'is_active'],
|
||||||
}],
|
required :false
|
||||||
required :false
|
}],
|
||||||
})
|
required :false
|
||||||
.then(MasterData => {
|
}],
|
||||||
Entities.findAll({where : { losid } , attributes: ['id', 'losid' , 'pan' , 'cin' , 'bizname' , 'entity_type' , 'activity_group' , 'biz_act_desc' ] })
|
required :false
|
||||||
.then(EntitiesData => {
|
})
|
||||||
let data = [];
|
.then(MasterData => {
|
||||||
EntitiesData.forEach((value, key)=>{
|
Entities.findAll({where : { losid } , attributes: ['id', 'losid' , 'pan' , 'cin' , 'bizname' , 'entity_type' , 'activity_group' , 'biz_act_desc' ] })
|
||||||
obj_data = { ...value.dataValues , statementsmasterrData:MasterData }
|
.then(EntitiesData => {
|
||||||
|
let data = [];
|
||||||
data.push(obj_data);
|
EntitiesData.forEach((value, key)=>{
|
||||||
}); // end of EntitiesData foreach
|
obj_data = { ...value.dataValues , statementsmasterrData:MasterData }
|
||||||
|
|
||||||
res.send({'status':200,'message':"success",'data':data});
|
data.push(obj_data);
|
||||||
logMsg.info("MenuList api working");
|
}); // end of EntitiesData foreach
|
||||||
}); // end of findall EntitiesData
|
|
||||||
}); // end of findall masters datas
|
res.send({'status':200,'message':"success",'data':data});
|
||||||
//} // end of starter function if condition
|
logMsg.info("MenuList api working");
|
||||||
|
}); // end of findall EntitiesData
|
||||||
|
}); // end of findall masters datas
|
||||||
|
} // end of starter function if condition
|
||||||
|
},5000)
|
||||||
} 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"})
|
||||||
@ -296,6 +299,7 @@ Pro42Data.forEach((Pro42Datavalue, key)=>{
|
|||||||
Financials.bulkCreate(fin_data_array);
|
Financials.bulkCreate(fin_data_array);
|
||||||
//console.log(fin_data_array)
|
//console.log(fin_data_array)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
res.status(404).send({'status':404,
|
res.status(404).send({'status':404,
|
||||||
@ -312,10 +316,10 @@ Pro42Data.forEach((Pro42Datavalue, key)=>{
|
|||||||
}); // 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 {'status':200,'message':"success",'data':"No data"}; // success message
|
return {'status':200,'message':"success",'data':"No data"}; // success message
|
||||||
|
|
||||||
|
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
res.status(500).send({'status':404,
|
res.status(500).send({'status':404,
|
||||||
message: err.message || "Some error occurred while inserting statements." ,'data': "No data"
|
message: err.message || "Some error occurred while inserting statements." ,'data': "No data"
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
const {sequelize , Statementsmaster ,Sectionsmaster , Subsectionsmaster,Itemsmaster ,Fin_remarks,Fin_masters_history,Statement_type} = require('../models')
|
const {sequelize , Statementsmaster ,Sectionsmaster , Subsectionsmaster,Itemsmaster ,Fin_remarks,Fin_masters_history,Statement_type,Entityfinyears} = require('../models')
|
||||||
const { logMsg } = require('../services/logger.js');
|
const { logMsg } = require('../services/logger.js');
|
||||||
|
|
||||||
|
|
||||||
@ -265,7 +265,7 @@ exports.Insertitem = (req, res) => {
|
|||||||
subsection: req.body.subsection,
|
subsection: req.body.subsection,
|
||||||
itemtext: req.body.itemtext,
|
itemtext: req.body.itemtext,
|
||||||
is_active: req.body.is_active,
|
is_active: req.body.is_active,
|
||||||
pvt_ltd: req.body.pvt_ltd,
|
pvtltd: req.body.pvtltd,
|
||||||
llp: req.body.llp,
|
llp: req.body.llp,
|
||||||
others: req.body.others,
|
others: req.body.others,
|
||||||
formula: req.body.formula,
|
formula: req.body.formula,
|
||||||
@ -432,7 +432,7 @@ exports.Historyapi = (req, res) => {
|
|||||||
|
|
||||||
|
|
||||||
// Retrieve all statement types from the database.
|
// Retrieve all statement types from the database.
|
||||||
exports.Statement_type = (req, res) => {
|
exports.Statementtype_list = (req, res) => {
|
||||||
|
|
||||||
Statement_type.findAll({where : { is_active : 1}})
|
Statement_type.findAll({where : { is_active : 1}})
|
||||||
.then(data => {
|
.then(data => {
|
||||||
@ -446,6 +446,26 @@ exports.Statement_type = (req, res) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
exports.Statementtype_insert = (req, res) => {
|
||||||
|
const req_array_data = req.body;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// const losid = req_array_data.losid;
|
||||||
|
//const entityid = req_array_data.entityid;
|
||||||
|
Entityfinyears.update({ "Y1_st_type":req_array_data.Y1_st_type,"Y2_st_type":req_array_data.Y2_st_type,"Y3_st_type":req_array_data.Y3_st_type,"updatedby":req_array_data.updatedby },{ where: { entityid:req_array_data.entityid}})
|
||||||
|
|
||||||
|
res.send({'status':200,'message':"success",'data':"No data"});
|
||||||
|
logMsg.info("Statementtype_insert Success");
|
||||||
|
}catch(err) {
|
||||||
|
res.status(500).send({'status':404,
|
||||||
|
message: err.message || "Some error occurred while inserting Statementtype_insert." ,'data': "No data"
|
||||||
|
}); }
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -523,11 +543,6 @@ exports.Statement_type = (req, res) => {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -3,6 +3,7 @@ module.exports = app => {
|
|||||||
const cors=require('cors');
|
const cors=require('cors');
|
||||||
const financials = require("../controllers/financial.controller.js");
|
const financials = require("../controllers/financial.controller.js");
|
||||||
const master = require("../controllers/master.controller.js");
|
const master = require("../controllers/master.controller.js");
|
||||||
|
const test = require("../controllers/test.controller.js");
|
||||||
const { logMsg } = require('../services/logger.js');
|
const { logMsg } = require('../services/logger.js');
|
||||||
var router = require("express").Router();
|
var router = require("express").Router();
|
||||||
|
|
||||||
@ -151,19 +152,111 @@ module.exports = app => {
|
|||||||
// create broken periods
|
// create broken periods
|
||||||
router.post("/BrokenPeriods", financials.BrokenPeriods);
|
router.post("/BrokenPeriods", financials.BrokenPeriods);
|
||||||
// create financials data
|
// create financials data
|
||||||
|
|
||||||
|
|
||||||
router.post("/createFinancials", financials.createFinancials);
|
router.post("/createFinancials", financials.createFinancials);
|
||||||
|
|
||||||
// create new FinancialYear skeletion
|
// create new FinancialYear skeletion
|
||||||
//post_object = {"losid":"MW12233","entityid":6,"fy":2022,"st_type":2}
|
//post_object = {"losid":"MW12233","entityid":6,"fy":2022,"st_type":2}
|
||||||
|
/**
|
||||||
|
* @swagger
|
||||||
|
* definitions:
|
||||||
|
* NewFinancialYear:
|
||||||
|
* type: object
|
||||||
|
* properties:
|
||||||
|
* losid:
|
||||||
|
* type: string
|
||||||
|
* description: losid
|
||||||
|
* example: MW12233
|
||||||
|
* entityid:
|
||||||
|
* type: integer
|
||||||
|
* description: entityid
|
||||||
|
* example: 1
|
||||||
|
* fy:
|
||||||
|
* type: integer
|
||||||
|
* description: financial Year
|
||||||
|
* example: 2022
|
||||||
|
* st_type:
|
||||||
|
* type: integer
|
||||||
|
* description: statement type
|
||||||
|
* example: 2
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* @swagger
|
||||||
|
* /api/createFinancialYear:
|
||||||
|
* post:
|
||||||
|
* summary: createFinancials
|
||||||
|
* description: createFinancials
|
||||||
|
* requestBody:
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/definitions/NewFinancialYear'
|
||||||
|
* responses:
|
||||||
|
* 200:
|
||||||
|
* description: New Financials Year inserted
|
||||||
|
* 500:
|
||||||
|
* description: failure in inserting New Financials Year
|
||||||
|
*/
|
||||||
router.post("/createFinancialYear", financials.createFinancialYear);
|
router.post("/createFinancialYear", financials.createFinancialYear);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @openapi
|
||||||
|
* /api/Statementtype_list:
|
||||||
|
* get:
|
||||||
|
* description: This is List api Statementtype
|
||||||
|
* responses:
|
||||||
|
* 200:
|
||||||
|
* description: Returns Statementtype.
|
||||||
|
*/
|
||||||
|
|
||||||
|
router.get("/Statementtype_list", master.Statementtype_list);
|
||||||
|
/**
|
||||||
|
* @swagger
|
||||||
router.get("/Statement_type", master.Statement_type);
|
* definitions:
|
||||||
|
* Statementtype:
|
||||||
|
* type: object
|
||||||
|
* properties:
|
||||||
|
* entityid:
|
||||||
|
* type: integer
|
||||||
|
* description: entityid
|
||||||
|
* example: 1
|
||||||
|
* Y1_st_type:
|
||||||
|
* type: integer
|
||||||
|
* description: First Year statement type
|
||||||
|
* example: 1
|
||||||
|
* Y2_st_type:
|
||||||
|
* type: integer
|
||||||
|
* description: Second Year statement type
|
||||||
|
* example: 1
|
||||||
|
* Y3_st_type:
|
||||||
|
* type: integer
|
||||||
|
* description: Third Year statement type
|
||||||
|
* example: 1
|
||||||
|
* updatedby:
|
||||||
|
* type: integer
|
||||||
|
* description: The person who modified
|
||||||
|
* example: 1
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* @swagger
|
||||||
|
* /api/Statementtype_insert:
|
||||||
|
* post:
|
||||||
|
* summary: Statementtype_insert
|
||||||
|
* description: statement type insert against corresponds year
|
||||||
|
* requestBody:
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/definitions/Statementtype'
|
||||||
|
* responses:
|
||||||
|
* 200:
|
||||||
|
* description: Statementtype inserted
|
||||||
|
* 500:
|
||||||
|
* description: failure in inserting Statementtype
|
||||||
|
*/
|
||||||
|
router.post("/Statementtype_insert", master.Statementtype_insert);
|
||||||
|
router.get("/intiator", test.intiator);
|
||||||
/**
|
/**
|
||||||
* @swagger
|
* @swagger
|
||||||
* definitions:
|
* definitions:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user