Surya: swagger
This commit is contained in:
parent
e2d2114a77
commit
7c07a02d47
@ -326,7 +326,8 @@ exports.Deleteitem = (req, res) => {
|
|||||||
// Retrieve all items from the database which is under by the represent section.
|
// Retrieve all items from the database which is under by the represent section.
|
||||||
exports.ItemFilter = (req, res) => {
|
exports.ItemFilter = (req, res) => {
|
||||||
const section = req.params.section
|
const section = req.params.section
|
||||||
Itemsmaster.findAll({where : { section : section }})
|
const statement = req.params.statement
|
||||||
|
Itemsmaster.findAll({where : { section : section}})
|
||||||
// sequelize.query("SELECT itemsmaster.id,itemsmaster.statement as statement_id,statementsmaster.statement,itemsmaster.section as section_id,sectionsmaster.section,itemsmaster.subsection as subsection_id,subsectionsmaster.subsection,subsectionsmaster.itemtext as subsection_itemtext ,itemsmaster.itemtext,itemsmaster.is_active,pvtltd,llp,others,formula,is_calculated,itemsmaster.createdby,itemsmaster.createdon,itemsmaster.updatedby,itemsmaster.updatedon FROM itemsmaster JOIN statementsmaster ON itemsmaster.statement=statementsmaster.id JOIN sectionsmaster ON itemsmaster.section= sectionsmaster.id JOIN subsectionsmaster ON itemsmaster.subsection= subsectionsmaster.id")
|
// sequelize.query("SELECT itemsmaster.id,itemsmaster.statement as statement_id,statementsmaster.statement,itemsmaster.section as section_id,sectionsmaster.section,itemsmaster.subsection as subsection_id,subsectionsmaster.subsection,subsectionsmaster.itemtext as subsection_itemtext ,itemsmaster.itemtext,itemsmaster.is_active,pvtltd,llp,others,formula,is_calculated,itemsmaster.createdby,itemsmaster.createdon,itemsmaster.updatedby,itemsmaster.updatedon FROM itemsmaster JOIN statementsmaster ON itemsmaster.statement=statementsmaster.id JOIN sectionsmaster ON itemsmaster.section= sectionsmaster.id JOIN subsectionsmaster ON itemsmaster.subsection= subsectionsmaster.id")
|
||||||
.then(data => {
|
.then(data => {
|
||||||
res.send({'status':200,'message':"success",'data':data});
|
res.send({'status':200,'message':"success",'data':data});
|
||||||
|
|||||||
@ -34,6 +34,6 @@ module.exports = (sequelize, DataTypes) => {
|
|||||||
updatedAt: 'updatedon',
|
updatedAt: 'updatedon',
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
logMsg.info("Success-model ")
|
// logMsg.info("Success-model ")
|
||||||
return Statementsmaster
|
return Statementsmaster
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,10 +1,11 @@
|
|||||||
module.exports = app => {
|
module.exports = app => {
|
||||||
const request = require("request");
|
const request = require("request");
|
||||||
|
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 { logMsg } = require('../services/logger.js');
|
const { logMsg } = require('../services/logger.js');
|
||||||
var router = require("express").Router();
|
var router = require("express").Router();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @openapi
|
* @openapi
|
||||||
@ -31,9 +32,39 @@ module.exports = app => {
|
|||||||
router.get("/MasterDatas", financials.MasterDatas);
|
router.get("/MasterDatas", financials.MasterDatas);
|
||||||
|
|
||||||
|
|
||||||
//master.controller api's
|
|
||||||
// get statment master data
|
|
||||||
/**
|
/**
|
||||||
|
* @swagger
|
||||||
|
* definitions:
|
||||||
|
* statement:
|
||||||
|
* type: object
|
||||||
|
* properties:
|
||||||
|
* statement:
|
||||||
|
* type: string
|
||||||
|
* description: name of the statement
|
||||||
|
* example: 'profit'
|
||||||
|
* is_active:
|
||||||
|
* type: integer
|
||||||
|
* description: the state of statement(0 means inactive,1 means active)
|
||||||
|
* example: 1
|
||||||
|
* createdby:
|
||||||
|
* type: integer
|
||||||
|
* description: The person who created
|
||||||
|
* example: 1
|
||||||
|
* updatedby:
|
||||||
|
* type: integer
|
||||||
|
* description: The person who modified
|
||||||
|
* example: 1
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
//master.controller api's
|
||||||
|
// get statment master data
|
||||||
|
|
||||||
|
|
||||||
|
//logMsg.info("Success -route ");
|
||||||
|
/**
|
||||||
* @openapi
|
* @openapi
|
||||||
* /api/StatementsList:
|
* /api/StatementsList:
|
||||||
* get:
|
* get:
|
||||||
@ -42,29 +73,64 @@ module.exports = app => {
|
|||||||
* 200:
|
* 200:
|
||||||
* description: Returns a mysterious string.
|
* description: Returns a mysterious string.
|
||||||
*/
|
*/
|
||||||
logMsg.info("Success -route ");
|
|
||||||
router.get("/StatementsList", master.StatementsList);
|
router.get("/StatementsList", master.StatementsList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @swagger
|
||||||
|
* /api/Insertstatement:
|
||||||
|
* post:
|
||||||
|
* summary: create statement
|
||||||
|
* description: create statement
|
||||||
|
* requestBody:
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/definitions/statement'
|
||||||
|
* responses:
|
||||||
|
* 200:
|
||||||
|
* description: statement created succesfully
|
||||||
|
* 500:
|
||||||
|
* description: failure in creating statement
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* @openapi
|
|
||||||
* /api/Insertstatement:
|
|
||||||
* get:
|
|
||||||
* description: This is Insert api statement!
|
|
||||||
* responses:
|
|
||||||
* 200:
|
|
||||||
* description: Returns a mysterious string.
|
|
||||||
*/
|
|
||||||
|
|
||||||
router.post("/Insertstatement", master.Insertstatement);
|
router.post("/Insertstatement", master.Insertstatement);
|
||||||
/**
|
/**
|
||||||
* @openapi
|
* @swagger
|
||||||
* /api/Updatestatement/:id:
|
* /api/Updatestatement/{id}:
|
||||||
* get:
|
* put:
|
||||||
* description: This is update api statement!
|
* summary: update statement
|
||||||
* responses:
|
* description: update statement
|
||||||
* 200:
|
* consumes:
|
||||||
* description: Returns a mysterious string.
|
* - application/json
|
||||||
|
* produces:
|
||||||
|
* - application/json
|
||||||
|
* parameters:
|
||||||
|
* - in: path
|
||||||
|
* name: id
|
||||||
|
* schema:
|
||||||
|
* type: integer
|
||||||
|
* required: true
|
||||||
|
* description: id of the statement
|
||||||
|
* example: 2
|
||||||
|
* - in: body
|
||||||
|
* name: body
|
||||||
|
* required: true
|
||||||
|
* description: body object
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/definitions/statement'
|
||||||
|
* requestBody:
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/definitions/statement'
|
||||||
|
* responses:
|
||||||
|
* 200:
|
||||||
|
* description: success
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/definitions/statement'
|
||||||
*/
|
*/
|
||||||
router.put("/Updatestatement/:id", master.Updatestatement);
|
router.put("/Updatestatement/:id", master.Updatestatement);
|
||||||
/**
|
/**
|
||||||
@ -79,6 +145,34 @@ module.exports = app => {
|
|||||||
router.put("/Deletestatement/:id", master.Deletestatement);
|
router.put("/Deletestatement/:id", master.Deletestatement);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @swagger
|
||||||
|
* definitions:
|
||||||
|
* section:
|
||||||
|
* type: object
|
||||||
|
* properties:
|
||||||
|
* statement:
|
||||||
|
* type: integer
|
||||||
|
* description: id of the statement
|
||||||
|
* example: 1
|
||||||
|
* section:
|
||||||
|
* type: string
|
||||||
|
* description: name of the section
|
||||||
|
* example: 'section'
|
||||||
|
* is_active:
|
||||||
|
* type: integer
|
||||||
|
* description: the state of section(0 means inactive,1 means active)
|
||||||
|
* example: 1
|
||||||
|
* createdby:
|
||||||
|
* type: integer
|
||||||
|
* description: The person who created
|
||||||
|
* example: 1
|
||||||
|
* updatedby:
|
||||||
|
* type: integer
|
||||||
|
* description: The person who modified
|
||||||
|
* example: 1
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @openapi
|
* @openapi
|
||||||
@ -91,24 +185,60 @@ module.exports = app => {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
router.get("/SectionList", master.SectionList);
|
router.get("/SectionList", master.SectionList);
|
||||||
/**
|
/**
|
||||||
* @openapi
|
* @swagger
|
||||||
* /api/Insertsection:
|
* /api/Insertsection:
|
||||||
* get:
|
* post:
|
||||||
* description: Welcome to swagger-jsdoc!
|
* summary: create section
|
||||||
* responses:
|
* description: create section
|
||||||
* 200:
|
* requestBody:
|
||||||
* description: Returns a mysterious string.
|
* content:
|
||||||
*/
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/definitions/section'
|
||||||
|
* responses:
|
||||||
|
* 200:
|
||||||
|
* description: section created succesfully
|
||||||
|
* 500:
|
||||||
|
* description: failure in creating section
|
||||||
|
*/
|
||||||
router.post("/Insertsection", master.Insertsection);
|
router.post("/Insertsection", master.Insertsection);
|
||||||
/**
|
/**
|
||||||
* @openapi
|
* @swagger
|
||||||
* /api/Updatesection/:id:
|
* /api/Updatesection/{id}:
|
||||||
* get:
|
* put:
|
||||||
* description: Welcome to swagger-jsdoc!
|
* summary: update section
|
||||||
* responses:
|
* description: update section
|
||||||
* 200:
|
* consumes:
|
||||||
* description: Returns a mysterious string.
|
* - application/json
|
||||||
|
* produces:
|
||||||
|
* - application/json
|
||||||
|
* parameters:
|
||||||
|
* - in: path
|
||||||
|
* name: id
|
||||||
|
* schema:
|
||||||
|
* type: integer
|
||||||
|
* required: true
|
||||||
|
* description: id of the section
|
||||||
|
* example: 2
|
||||||
|
* - in: body
|
||||||
|
* name: body
|
||||||
|
* required: true
|
||||||
|
* description: body object
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/definitions/section'
|
||||||
|
* requestBody:
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/definitions/section'
|
||||||
|
* responses:
|
||||||
|
* 200:
|
||||||
|
* description: success
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/definitions/section'
|
||||||
*/
|
*/
|
||||||
router.put("/Updatesection/:id", master.Updatesection);
|
router.put("/Updatesection/:id", master.Updatesection);
|
||||||
/**
|
/**
|
||||||
@ -122,7 +252,34 @@ module.exports = app => {
|
|||||||
*/
|
*/
|
||||||
router.put("/Deletesection/:id", master.Deletesection);
|
router.put("/Deletesection/:id", master.Deletesection);
|
||||||
|
|
||||||
|
//************************************************************
|
||||||
|
/**
|
||||||
|
* @swagger
|
||||||
|
* definitions:
|
||||||
|
* subsection:
|
||||||
|
* type: object
|
||||||
|
* properties:
|
||||||
|
* section:
|
||||||
|
* type: integer
|
||||||
|
* description: id of the section
|
||||||
|
* example: 1
|
||||||
|
* subsection:
|
||||||
|
* type: string
|
||||||
|
* description: name of the subsection
|
||||||
|
* example: 'subsection'
|
||||||
|
* is_active:
|
||||||
|
* type: integer
|
||||||
|
* description: the state of subsection(0 means inactive,1 means active)
|
||||||
|
* example: 1
|
||||||
|
* createdby:
|
||||||
|
* type: integer
|
||||||
|
* description: The person who created
|
||||||
|
* example: 1
|
||||||
|
* updatedby:
|
||||||
|
* type: integer
|
||||||
|
* description: The person who modified
|
||||||
|
* example: 1
|
||||||
|
*/
|
||||||
/**
|
/**
|
||||||
* @openapi
|
* @openapi
|
||||||
* /api/SubsectionList:
|
* /api/SubsectionList:
|
||||||
@ -133,24 +290,60 @@ module.exports = app => {
|
|||||||
* description: Returns a mysterious string.
|
* description: Returns a mysterious string.
|
||||||
*/
|
*/
|
||||||
router.get("/SubsectionList", master.SubsectionList);
|
router.get("/SubsectionList", master.SubsectionList);
|
||||||
/**
|
/**
|
||||||
* @openapi
|
* @swagger
|
||||||
* /api/Insertsubsection:
|
* /api/Insertsubsection:
|
||||||
* get:
|
* post:
|
||||||
* description: Welcome to swagger-jsdoc!
|
* summary: create subsection
|
||||||
* responses:
|
* description: create subsection
|
||||||
* 200:
|
* requestBody:
|
||||||
* description: Returns a mysterious string.
|
* content:
|
||||||
*/
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/definitions/subsection'
|
||||||
|
* responses:
|
||||||
|
* 200:
|
||||||
|
* description: subsection created succesfully
|
||||||
|
* 500:
|
||||||
|
* description: failure in creating subsection
|
||||||
|
*/
|
||||||
router.post("/Insertsubsection", master.Insertsubsection);
|
router.post("/Insertsubsection", master.Insertsubsection);
|
||||||
/**
|
/**
|
||||||
* @openapi
|
* @swagger
|
||||||
* /api/Updatesubsection/:id:
|
* /api/Updatesubsection/{id}:
|
||||||
* get:
|
* put:
|
||||||
* description: Welcome to swagger-jsdoc!
|
* summary: update subsection
|
||||||
* responses:
|
* description: update subsection
|
||||||
* 200:
|
* consumes:
|
||||||
* description: Returns a mysterious string.
|
* - application/json
|
||||||
|
* produces:
|
||||||
|
* - application/json
|
||||||
|
* parameters:
|
||||||
|
* - in: path
|
||||||
|
* name: id
|
||||||
|
* schema:
|
||||||
|
* type: integer
|
||||||
|
* required: true
|
||||||
|
* description: id of the subsection
|
||||||
|
* example: 2
|
||||||
|
* - in: body
|
||||||
|
* name: body
|
||||||
|
* required: true
|
||||||
|
* description: body object
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/definitions/subsection'
|
||||||
|
* requestBody:
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/definitions/subsection'
|
||||||
|
* responses:
|
||||||
|
* 200:
|
||||||
|
* description: success
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/definitions/subsection'
|
||||||
*/
|
*/
|
||||||
router.put("/Updatesubsection/:id", master.Updatesubsection);
|
router.put("/Updatesubsection/:id", master.Updatesubsection);
|
||||||
/**
|
/**
|
||||||
@ -165,6 +358,61 @@ module.exports = app => {
|
|||||||
router.put("/Deletesubsection/:id", master.Deletesubsection);
|
router.put("/Deletesubsection/:id", master.Deletesubsection);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @swagger
|
||||||
|
* definitions:
|
||||||
|
* item:
|
||||||
|
* type: object
|
||||||
|
* properties:
|
||||||
|
* statement:
|
||||||
|
* type: integer
|
||||||
|
* description: id of the statement
|
||||||
|
* example: 1
|
||||||
|
* section:
|
||||||
|
* type: integer
|
||||||
|
* description: id of the section
|
||||||
|
* example: 1
|
||||||
|
* subsection:
|
||||||
|
* type: integer
|
||||||
|
* description: id of the subsection
|
||||||
|
* example: 1
|
||||||
|
* itemtext:
|
||||||
|
* type: string
|
||||||
|
* description: name of the item
|
||||||
|
* example: 'itemtext'
|
||||||
|
* pvtltd:
|
||||||
|
* type: integer
|
||||||
|
* description: pvtltd - Private Limited
|
||||||
|
* example: 1
|
||||||
|
* llp:
|
||||||
|
* type: integer
|
||||||
|
* description: llp
|
||||||
|
* example: 1
|
||||||
|
* others:
|
||||||
|
* type: integer
|
||||||
|
* description: others
|
||||||
|
* example: 1
|
||||||
|
* formula:
|
||||||
|
* type: string
|
||||||
|
* description: formula
|
||||||
|
* example: 'a+b'
|
||||||
|
* is_calculated:
|
||||||
|
* type: integer
|
||||||
|
* description: is_calculated - it shows the field need to be calculate or not
|
||||||
|
* example: 1
|
||||||
|
* is_active:
|
||||||
|
* type: integer
|
||||||
|
* description: the state of section(0 means inactive,1 means active)
|
||||||
|
* example: 1
|
||||||
|
* createdby:
|
||||||
|
* type: integer
|
||||||
|
* description: The person who created
|
||||||
|
* example: 1
|
||||||
|
* updatedby:
|
||||||
|
* type: integer
|
||||||
|
* description: The person who modified
|
||||||
|
* example: 1
|
||||||
|
*/
|
||||||
/**
|
/**
|
||||||
* @openapi
|
* @openapi
|
||||||
* /api/ItemList:
|
* /api/ItemList:
|
||||||
@ -175,24 +423,60 @@ module.exports = app => {
|
|||||||
* description: Returns a mysterious string.
|
* description: Returns a mysterious string.
|
||||||
*/
|
*/
|
||||||
router.get("/ItemList", master.ItemList);
|
router.get("/ItemList", master.ItemList);
|
||||||
/**
|
/**
|
||||||
* @openapi
|
* @swagger
|
||||||
* /api/Insertitem:
|
* /api/Insertitem:
|
||||||
* get:
|
* post:
|
||||||
* description: Welcome to swagger-jsdoc!
|
* summary: create item
|
||||||
* responses:
|
* description: create item
|
||||||
* 200:
|
* requestBody:
|
||||||
* description: Returns a mysterious string.
|
* content:
|
||||||
*/
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/definitions/item'
|
||||||
|
* responses:
|
||||||
|
* 200:
|
||||||
|
* description: item created succesfully
|
||||||
|
* 500:
|
||||||
|
* description: failure in creating item
|
||||||
|
*/
|
||||||
router.post("/Insertitem", master.Insertitem);
|
router.post("/Insertitem", master.Insertitem);
|
||||||
/**
|
/**
|
||||||
* @openapi
|
* @swagger
|
||||||
* /api/Updateitem/:id:
|
* /api/Updateitem/{id}:
|
||||||
* get:
|
* put:
|
||||||
* description: Welcome to swagger-jsdoc!
|
* summary: update item
|
||||||
* responses:
|
* description: update item
|
||||||
* 200:
|
* consumes:
|
||||||
* description: Returns a mysterious string.
|
* - application/json
|
||||||
|
* produces:
|
||||||
|
* - application/json
|
||||||
|
* parameters:
|
||||||
|
* - in: path
|
||||||
|
* name: id
|
||||||
|
* schema:
|
||||||
|
* type: integer
|
||||||
|
* required: true
|
||||||
|
* description: id of the item
|
||||||
|
* example: 2
|
||||||
|
* - in: body
|
||||||
|
* name: body
|
||||||
|
* required: true
|
||||||
|
* description: body object
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/definitions/item'
|
||||||
|
* requestBody:
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/definitions/item'
|
||||||
|
* responses:
|
||||||
|
* 200:
|
||||||
|
* description: success
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/definitions/item'
|
||||||
*/
|
*/
|
||||||
router.put("/Updateitem/:id", master.Updateitem);
|
router.put("/Updateitem/:id", master.Updateitem);
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user