From da2fe645a78d44bb5c5e201f2d04fc16c590193a Mon Sep 17 00:00:00 2001 From: suseendhiran17 <58357088+suseendhiran17@users.noreply.github.com> Date: Wed, 23 Mar 2022 12:25:39 +0530 Subject: [PATCH] commit susee --- app/controllers/obligation.controller.js | 41 ++++++++++++--------- app/routes/routes.js | 47 ++++++++++++------------ server.js | 4 +- 3 files changed, 50 insertions(+), 42 deletions(-) diff --git a/app/controllers/obligation.controller.js b/app/controllers/obligation.controller.js index 0371cbf..045c7fa 100644 --- a/app/controllers/obligation.controller.js +++ b/app/controllers/obligation.controller.js @@ -1,23 +1,6 @@ const { sequelize,Test,OblicationMaster,OblicationBurearBankStatement} = require('../models') const { logMsg } = require('../services/logger.js'); -exports.Welcome = (req, res) => -{ - try - { - const Msg = "Welcome....!"; - console.log(Msg); - logMsg.info("Api Call Success"); - res.send({'status':200 , message:"Success." ,'data': Msg}); - - } catch(err) { - res.status(500).send({'status':404, - message: err.message || "Some error occurred while inserting statements." ,'data': "No data" - }); - } //end of try catch - -}; - exports.ObligationMaster = async (req, res) => { @@ -42,6 +25,30 @@ exports.ObligationMaster = async (req, res) => }; + +exports.GetOblicationBurearBankStatement = async (req, res) => +{ + try + { + await OblicationBurearBankStatement.findAll({where : {los_id : req.query.los_id , 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 Obligation bank statement." ,'data': "No data" }); + }); + + } catch(err) { + res.send({'status':404, + message: err.message || "Some error occurred while fetching Obligation masterdata bank statement." ,'data': "No data" + }); + } //end of try catch + +}; + exports.CreateObligationMaster = async (req, res) => { try diff --git a/app/routes/routes.js b/app/routes/routes.js index 76fdf4d..8570948 100644 --- a/app/routes/routes.js +++ b/app/routes/routes.js @@ -6,25 +6,6 @@ module.exports = app => { var router = require("express").Router(); - - -//demo api - -/** -* @swagger -* /api/demo: -* get: -* summary: Demo Api -* description: Welcome Message -* responses: -* 200: -* description: success -*/ - router.get("/demo", Mycontroller.Welcome); - - - - // get obligation masterdata @@ -41,12 +22,32 @@ module.exports = app => { router.get("/obligationmaster",Mycontroller.ObligationMaster) - +// get oblication burear bankstatement + + +/** +* @swagger +* /api/getoblicationburearbankstatement: +* get: +* summary: Get Oblication Burear Bank Statement List +* description: Get Oblication Burear Bank Statement +* parameters: +* - in: query +* name: los_id +* schema: +* type: string +* required: true +* description: Oblication Burear Bank Statement +* example: 12abc +* responses: +* 200: +* description: success +*/ +router.get("/getoblicationburearbankstatement",Mycontroller.GetOblicationBurearBankStatement) // create oblication burear bankstatement - /** * @swagger * definitions: @@ -131,7 +132,7 @@ router.post("/createobligationmaster",Mycontroller.CreateObligationMaster) * avg_peak_util_of_the_OD_or_CC: * type: string * description: avgPeakUtilOfTheOD_or_CC -* example: 5000 +* example: abc * nature_of_loan: * type: string * description: natureOfLoan @@ -275,7 +276,7 @@ router.post("/createobligationmaster",Mycontroller.CreateObligationMaster) * avg_peak_util_of_the_OD_or_CC: * type: string * description: avgPeakUtilOfTheOD_or_CC -* example:5000 +* example: abc * nature_of_loan: * type: string * description: natureOfLoan diff --git a/server.js b/server.js index 7c88d05..101260c 100644 --- a/server.js +++ b/server.js @@ -19,7 +19,7 @@ const options = { definition: { openapi: '3.0.0', info: { - title: 'Smc_cet_financials', + title: 'Smc_cet_obligation', version: '1.0.0', }, }, @@ -56,7 +56,7 @@ require("./app/routes/routes.js")(app); const PORT_NUMBER = process.env.SERVER_PORT app.listen({ port: PORT_NUMBER }, async () => { - console.log('Server up on http://localhost:7080') + console.log('Server up on http://localhost:'+ PORT_NUMBER) //await sequelize.authenticate() }) \ No newline at end of file