Surya: swagger

This commit is contained in:
surya 2021-08-25 18:20:30 +05:30
parent e2d2114a77
commit 7c07a02d47
3 changed files with 360 additions and 75 deletions

View File

@ -326,6 +326,7 @@ 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
const statement = req.params.statement
Itemsmaster.findAll({where : { section : section}}) 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 => {

View File

@ -34,6 +34,6 @@ module.exports = (sequelize, DataTypes) => {
updatedAt: 'updatedon', updatedAt: 'updatedon',
} }
) )
logMsg.info("Success-model ") // logMsg.info("Success-model ")
return Statementsmaster return Statementsmaster
} }

View File

@ -1,5 +1,6 @@
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');
@ -31,8 +32,38 @@ module.exports = app => {
router.get("/MasterDatas", financials.MasterDatas); router.get("/MasterDatas", financials.MasterDatas);
/**
* @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 //master.controller api's
// get statment master data // get statment master data
//logMsg.info("Success -route ");
/** /**
* @openapi * @openapi
* /api/StatementsList: * /api/StatementsList:
@ -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);
/** /**
* @openapi * @swagger
* /api/Insertstatement: * /api/Insertstatement:
* get: * post:
* description: This is Insert api statement! * summary: create statement
* description: create statement
* requestBody:
* content:
* application/json:
* schema:
* $ref: '#/definitions/statement'
* responses: * responses:
* 200: * 200:
* description: Returns a mysterious string. * description: statement created succesfully
* 500:
* description: failure in creating statement
*/ */
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
* description: update statement
* consumes:
* - 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: * responses:
* 200: * 200:
* description: Returns a mysterious string. * 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
@ -92,23 +186,59 @@ 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
* description: create section
* requestBody:
* content:
* application/json:
* schema:
* $ref: '#/definitions/section'
* responses: * responses:
* 200: * 200:
* description: Returns a mysterious string. * 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
* description: update section
* consumes:
* - 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: * responses:
* 200: * 200:
* description: Returns a mysterious string. * 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:
@ -134,23 +291,59 @@ module.exports = app => {
*/ */
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
* description: create subsection
* requestBody:
* content:
* application/json:
* schema:
* $ref: '#/definitions/subsection'
* responses: * responses:
* 200: * 200:
* description: Returns a mysterious string. * 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
* description: update subsection
* consumes:
* - 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: * responses:
* 200: * 200:
* description: Returns a mysterious string. * 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:
@ -176,23 +424,59 @@ module.exports = app => {
*/ */
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
* description: create item
* requestBody:
* content:
* application/json:
* schema:
* $ref: '#/definitions/item'
* responses: * responses:
* 200: * 200:
* description: Returns a mysterious string. * 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
* description: update item
* consumes:
* - 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: * responses:
* 200: * 200:
* description: Returns a mysterious string. * description: success
* content:
* application/json:
* schema:
* $ref: '#/definitions/item'
*/ */
router.put("/Updateitem/:id", master.Updateitem); router.put("/Updateitem/:id", master.Updateitem);
/** /**