427 lines
9.0 KiB
JavaScript
427 lines
9.0 KiB
JavaScript
module.exports = app => {
|
|
const request = require("request");
|
|
const cors=require('cors');
|
|
const Mycontroller = require("../controllers/test.controller.js");
|
|
const SalesPdController = require("../controllers/salespd.controller.js");
|
|
const { logMsg } = require('../services/logger.js');
|
|
var router = require("express").Router();
|
|
router.post('/PullSalesPdshareholderData',SalesPdController.PullSalesPdshareholderData);
|
|
router.post('/ReInsertImageData',SalesPdController.ReInsertImageData);
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/demo:
|
|
* get:
|
|
* summary: Demo Api
|
|
* description: Welcome Message
|
|
* responses:
|
|
* 200:
|
|
* description: success
|
|
*/
|
|
router.get("/demo", Mycontroller.Welcome);
|
|
router.get("/test", SalesPdController.test);
|
|
// landing page api
|
|
/**
|
|
* @swagger
|
|
* /api/SalesPDLandingPageList:
|
|
* get:
|
|
* summary: get all sales pd data list general section
|
|
* description:
|
|
* parameters:
|
|
* - in: query
|
|
* name: losid
|
|
* schema:
|
|
* type: string
|
|
* required: true
|
|
* example: MW112233
|
|
* responses:
|
|
* 200:
|
|
* description: success
|
|
*/
|
|
router.get('/SalesPDLandingPageList',SalesPdController.SalesPDLandingPageList);
|
|
|
|
// phptograph upload
|
|
const multer = require('multer');
|
|
img_name = "";
|
|
const storage = multer.diskStorage({
|
|
destination: (req, file, cb) => {
|
|
cb(null, 'storage/uploads/');
|
|
},
|
|
filename: (req, file, cb) => {
|
|
img_name = "";
|
|
img_name += Date.now()+'-'+file.originalname;
|
|
cb(null, img_name);
|
|
}
|
|
});
|
|
|
|
const upload = multer({ storage });
|
|
/**
|
|
* @swagger
|
|
* definitions:
|
|
* PullSalesPdPhotographsData:
|
|
* type: object
|
|
* properties:
|
|
* pdid:
|
|
* type: integer
|
|
* description: pdid
|
|
* example: 6646
|
|
* product:
|
|
* type: string
|
|
* description: product
|
|
* example: LFMP
|
|
* caseno:
|
|
* type: string
|
|
* description:
|
|
* example: MW53315
|
|
* img:
|
|
* type: file
|
|
* description: image file
|
|
* example:
|
|
* img_name:
|
|
* type: string
|
|
* description: image file
|
|
* example: sample
|
|
*/
|
|
/**
|
|
* @swagger
|
|
* /api/PullSalesPdPhotographsData:
|
|
* post:
|
|
* summary: Pull SalesPd Photographs Data
|
|
* description: Pull SalesPd Photographs Data
|
|
* requestBody:
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* $ref: '#/definitions/PullSalesPdPhotographsData'
|
|
* responses:
|
|
* 200:
|
|
* description: success
|
|
* 500:
|
|
* description: failed
|
|
*/
|
|
router.post('/PullSalesPdPhotographsData', upload.single('img'),function(req,res){ SalesPdController.PullSalesPdPhotographsData(req,res,img_name); } );
|
|
/**
|
|
* @swagger
|
|
* /api/imageView:
|
|
* get:
|
|
* summary: view image file api
|
|
* description:
|
|
* parameters:
|
|
* - in: query
|
|
* name: img_name
|
|
* schema:
|
|
* type: integer
|
|
* required: true
|
|
* example:
|
|
* responses:
|
|
* 200:
|
|
* description: success
|
|
*/
|
|
router.get('/imageView',SalesPdController.imageView);
|
|
|
|
|
|
|
|
|
|
/**
|
|
* @swagger
|
|
* definitions:
|
|
* PullSalesPdData:
|
|
* type: object
|
|
* properties:
|
|
* pdid:
|
|
* type: integer
|
|
* description: pdid
|
|
* example: 6646
|
|
* product:
|
|
* type: string
|
|
* description: product
|
|
* example: LFMP
|
|
* caseno:
|
|
* type: string
|
|
* description:
|
|
* example: MW53315
|
|
* data:
|
|
* type: string
|
|
* description: json string
|
|
* example:
|
|
*/
|
|
/**
|
|
* @swagger
|
|
* /api/PullSalesPdData:
|
|
* post:
|
|
* summary: Pull SalesPd Data
|
|
* description: Pull SalesPd Data
|
|
* requestBody:
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* $ref: '#/definitions/PullSalesPdData'
|
|
* responses:
|
|
* 200:
|
|
* description: success
|
|
* 500:
|
|
* description: failed
|
|
*/
|
|
router.post("/PullSalesPdData", SalesPdController.PullSalesPdData);
|
|
|
|
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/DownloadPdReport:
|
|
* get:
|
|
* summary: Download Pd Report as pdf file
|
|
* description: Download Pd Report as pdf file
|
|
* parameters:
|
|
* - in: query
|
|
* name: ref_no
|
|
* schema:
|
|
* type: integer
|
|
* required: true
|
|
* example: 614
|
|
* responses:
|
|
* 200:
|
|
* description: success
|
|
*/
|
|
router.get("/DownloadPdReport", SalesPdController.DownloadPdReport);
|
|
|
|
|
|
//GeneralSection List Api
|
|
/**
|
|
* @swagger
|
|
* /api/SectionList:
|
|
* get:
|
|
* summary: General Section Data List with all child section data's
|
|
* description: Get General Section Data List
|
|
* parameters:
|
|
* - in: query
|
|
* name: losid
|
|
* schema:
|
|
* type: string
|
|
* required: true
|
|
* example: MW112233
|
|
* responses:
|
|
* 200:
|
|
* description: success
|
|
*/
|
|
router.get("/SectionList", SalesPdController.SectionList);
|
|
|
|
//BreifOfBusiness List Api
|
|
/**
|
|
* @swagger
|
|
* /api/BreifOfBusinessList:
|
|
* get:
|
|
* summary: BreifOfBusiness Data List
|
|
* description: Get BreifOfBusiness Data List
|
|
* parameters:
|
|
* - in: query
|
|
* name: pd_id
|
|
* schema:
|
|
* type: integer
|
|
* required: true
|
|
* example: 36
|
|
* responses:
|
|
* 200:
|
|
* description: success
|
|
*/
|
|
router.get("/BreifOfBusinessList", SalesPdController.BreifOfBusinessList);
|
|
|
|
//DetailsOfKeyShareHolder List Api
|
|
/**
|
|
* @swagger
|
|
* /api/DetailsOfKeyShareHolderList:
|
|
* get:
|
|
* summary: DetailsOfKeyShareHolder Data List
|
|
* description: Get DetailsOfKeyShareHolder Data List
|
|
* parameters:
|
|
* - in: query
|
|
* name: pd_id
|
|
* schema:
|
|
* type: integer
|
|
* required: true
|
|
* example: 36
|
|
* responses:
|
|
* 200:
|
|
* description: success
|
|
*/
|
|
router.get("/DetailsOfKeyShareHolderList", SalesPdController.DetailsOfKeyShareHolderList);
|
|
|
|
//FinalRemarks List Api
|
|
/**
|
|
* @swagger
|
|
* /api/FinalRemarksList:
|
|
* get:
|
|
* summary: FinalRemarks Data List
|
|
* description: Get FinalRemarks Data List
|
|
* parameters:
|
|
* - in: query
|
|
* name: pd_id
|
|
* schema:
|
|
* type: integer
|
|
* required: true
|
|
* example: 36
|
|
* responses:
|
|
* 200:
|
|
* description: success
|
|
*/
|
|
router.get("/FinalRemarksList", SalesPdController.FinalRemarksList);
|
|
|
|
//FinancialInformation List Api
|
|
/**
|
|
* @swagger
|
|
* /api/FinancialInformationList:
|
|
* get:
|
|
* summary: FinancialInformation Data List
|
|
* description: Get FinancialInformation Data List
|
|
* parameters:
|
|
* - in: query
|
|
* name: pd_id
|
|
* schema:
|
|
* type: integer
|
|
* required: true
|
|
* example: 36
|
|
* responses:
|
|
* 200:
|
|
* description: success
|
|
*/
|
|
router.get("/FinancialInformationList", SalesPdController.FinancialInformationList);
|
|
|
|
//FundRequirement List Api
|
|
/**
|
|
* @swagger
|
|
* /api/FundRequirementList:
|
|
* get:
|
|
* summary: FundRequirement Data List
|
|
* description: Get FundRequirement Data List
|
|
* parameters:
|
|
* - in: query
|
|
* name: pd_id
|
|
* schema:
|
|
* type: integer
|
|
* required: true
|
|
* example: 36
|
|
* responses:
|
|
* 200:
|
|
* description: success
|
|
*/
|
|
router.get("/FundRequirementList", SalesPdController.FundRequirementList);
|
|
|
|
//InstitutionDetail List Api
|
|
/**
|
|
* @swagger
|
|
* /api/InstitutionDetailList:
|
|
* get:
|
|
* summary: InstitutionDetail Data List
|
|
* description: Get InstitutionDetail Data List
|
|
* parameters:
|
|
* - in: query
|
|
* name: pd_id
|
|
* schema:
|
|
* type: integer
|
|
* required: true
|
|
* example: 36
|
|
* responses:
|
|
* 200:
|
|
* description: success
|
|
*/
|
|
router.get("/InstitutionDetailList", SalesPdController.InstitutionDetailList);
|
|
|
|
//OfficerDetails List Api
|
|
/**
|
|
* @swagger
|
|
* /api/OfficerDetailsList:
|
|
* get:
|
|
* summary: OfficerDetails Data List
|
|
* description: Get OfficerDetails Data List
|
|
* parameters:
|
|
* - in: query
|
|
* name: pd_id
|
|
* schema:
|
|
* type: integer
|
|
* required: true
|
|
* example: 36
|
|
* responses:
|
|
* 200:
|
|
* description: success
|
|
*/
|
|
router.get("/OfficerDetailsList", SalesPdController.OfficerDetailsList);
|
|
|
|
//Photograph List Api
|
|
/**
|
|
* @swagger
|
|
* /api/PhotographList:
|
|
* get:
|
|
* summary: Photograph Data List
|
|
* description: Get Photograph Data List
|
|
* parameters:
|
|
* - in: query
|
|
* name: pd_id
|
|
* schema:
|
|
* type: integer
|
|
* required: true
|
|
* example: 36
|
|
* responses:
|
|
* 200:
|
|
* description: success
|
|
*/
|
|
router.get("/PhotographList", SalesPdController.PhotographList);
|
|
|
|
//ProductInformation List Api
|
|
/**
|
|
* @swagger
|
|
* /api/ProductInformationList:
|
|
* get:
|
|
* summary: ProductInformation Data List
|
|
* description: Get ProductInformation Data List
|
|
* parameters:
|
|
* - in: query
|
|
* name: pd_id
|
|
* schema:
|
|
* type: integer
|
|
* required: true
|
|
* example: 36
|
|
* responses:
|
|
* 200:
|
|
* description: success
|
|
*/
|
|
router.get("/ProductInformationList", SalesPdController.ProductInformationList);
|
|
|
|
//PropertyInformation List Api
|
|
/**
|
|
* @swagger
|
|
* /api/PropertyInformationList:
|
|
* get:
|
|
* summary: PropertyInformation Data List
|
|
* description: Get PropertyInformation Data List
|
|
* parameters:
|
|
* - in: query
|
|
* name: pd_id
|
|
* schema:
|
|
* type: integer
|
|
* required: true
|
|
* example: 36
|
|
* responses:
|
|
* 200:
|
|
* description: success
|
|
*/
|
|
router.get("/PropertyInformationList", SalesPdController.PropertyInformationList);
|
|
|
|
|
|
|
|
router.get("/getfilename", SalesPdController.readLogFileName);
|
|
|
|
router.post("/readlogs", SalesPdController.readLogFile);
|
|
|
|
router.get("/view", SalesPdController.viewLandingPage);
|
|
|
|
router.post("/deletelog", SalesPdController.deleteLogFile);
|
|
|
|
|
|
|
|
|
|
// routes started here
|
|
app.use('/api', router);
|
|
};
|
|
|
|
|