smc_cet_credit_policy_backend/app/routes/routes.js
2023-07-20 13:25:42 +05:30

1196 lines
23 KiB
JavaScript

module.exports = app => {
const request = require("request");
const cors=require('cors');
const Mycontroller = require("../controllers/test.controller.js");
const CreditPolicy = require("../controllers/credit.policy.controller");
const { logMsg } = require('../services/logger.js');
var router = require("express").Router();
//Master Data select api
/**
* @swagger
* /api/MasterDataList:
* get:
* summary: MasterData Api
* description: MasterData Api
* responses:
* 200:
* description: success
*/
router.get("/MasterDataList", CreditPolicy.MasterDataList);
// Parameter MasterData select api
/**
* @swagger
* definitions:
* createProgramData:
* type: object
* properties:
* program_name:
* type: string
* description:
* example: test
* is_active:
* type: integer
* description:
* example: 1
* createdby:
* type: integer
* description:
* example: 1
*/
/**
* @swagger
* /api/createProgramData:
* post:
* summary:
* description:
* requestBody:
* content:
* application/json:
* schema:
* $ref: '#/definitions/createProgramData'
* responses:
* 200:
* description: create success
* 500:
* description: failure in create
*/
router.post("/createProgramData", CreditPolicy.createProgramData);
/**
* @swagger
* definitions:
* updateProgramData:
* type: object
* properties:
* id:
* type: integer
* description:
* example: 1
* program_name:
* type: string
* description:
* example: test
* is_active:
* type: integer
* description:
* example: 1
* updatedby:
* type: integer
* description:
* example: 1
*/
/**
* @swagger
* /api/updateProgramData:
* post:
* summary:
* description:
* requestBody:
* content:
* application/json:
* schema:
* $ref: '#/definitions/updateProgramData'
* responses:
* 200:
* description: update success
* 500:
* description: failure in update
*/
router.post("/updateProgramData", CreditPolicy.updateProgramData);
/**
* @swagger
* definitions:
* createCheckTypeData:
* type: object
* properties:
* check_type:
* type: string
* description:
* example: test
* is_active:
* type: integer
* description:
* example: 1
* createdby:
* type: integer
* description:
* example: 1
*/
/**
* @swagger
* /api/createCheckTypeData:
* post:
* summary:
* description:
* requestBody:
* content:
* application/json:
* schema:
* $ref: '#/definitions/createCheckTypeData'
* responses:
* 200:
* description: create success
* 500:
* description: failure in create
*/
router.post("/createCheckTypeData", CreditPolicy.createCheckTypeData);
/**
* @swagger
* definitions:
* updateCheckTypeData:
* type: object
* properties:
* id:
* type: integer
* description:
* example: 1
* check_type:
* type: string
* description:
* example: test
* is_active:
* type: integer
* description:
* example: 1
* updatedby:
* type: integer
* description:
* example: 1
*/
/**
* @swagger
* /api/updateCheckTypeData:
* post:
* summary:
* description:
* requestBody:
* content:
* application/json:
* schema:
* $ref: '#/definitions/updateCheckTypeData'
* responses:
* 200:
* description: update success
* 500:
* description: failure in update
*/
router.post("/updateCheckTypeData", CreditPolicy.updateCheckTypeData);
/**
* @swagger
* definitions:
* createPropertyTypeData:
* type: object
* properties:
* property_type:
* type: string
* description:
* example: test
* is_active:
* type: integer
* description:
* example: 1
* createdby:
* type: integer
* description:
* example: 1
*/
/**
* @swagger
* /api/createPropertyTypeData:
* post:
* summary:
* description:
* requestBody:
* content:
* application/json:
* schema:
* $ref: '#/definitions/createPropertyTypeData'
* responses:
* 200:
* description: create success
* 500:
* description: failure in create
*/
router.post("/createPropertyTypeData", CreditPolicy.createPropertyTypeData);
/**
* @swagger
* definitions:
* updatePropertyTypeData:
* type: object
* properties:
* id:
* type: integer
* description:
* example: 1
* property_type:
* type: string
* description:
* example: test
* is_active:
* type: integer
* description:
* example: 1
* updatedby:
* type: integer
* description:
* example: 1
*/
/**
* @swagger
* /api/updatePropertyTypeData:
* post:
* summary:
* description:
* requestBody:
* content:
* application/json:
* schema:
* $ref: '#/definitions/updatePropertyTypeData'
* responses:
* 200:
* description: update success
* 500:
* description: failure in update
*/
router.post("/updatePropertyTypeData", CreditPolicy.updatePropertyTypeData);
/**
* @swagger
* definitions:
* createBusinessActivityData:
* type: object
* properties:
* business_activity_name:
* type: string
* description:
* example: test
* is_active:
* type: integer
* description:
* example: 1
* createdby:
* type: integer
* description:
* example: 1
*/
/**
* @swagger
* /api/createBusinessActivityData:
* post:
* summary:
* description:
* requestBody:
* content:
* application/json:
* schema:
* $ref: '#/definitions/createBusinessActivityData'
* responses:
* 200:
* description: create success
* 500:
* description: failure in create
*/
router.post("/createBusinessActivityData", CreditPolicy.createBusinessActivityData);
/**
* @swagger
* definitions:
* updateBusinessActivityData:
* type: object
* properties:
* id:
* type: integer
* description:
* example: 1
* business_activity_name:
* type: string
* description:
* example: test
* is_active:
* type: integer
* description:
* example: 1
* updatedby:
* type: integer
* description:
* example: 1
*/
/**
* @swagger
* /api/updateBusinessActivityData:
* post:
* summary:
* description:
* requestBody:
* content:
* application/json:
* schema:
* $ref: '#/definitions/updateBusinessActivityData'
* responses:
* 200:
* description: update success
* 500:
* description: failure in update
*/
router.post("/updateBusinessActivityData", CreditPolicy.updateBusinessActivityData);
// Parameter Master Child Table Data select api
/**
* @swagger
* /api/PolicyMasterChildTableData:
* get:
* summary:
* description:
* parameters:
* - in: query
* name: table_name
* schema:
* type: string
* required: true
* example: financials_norms
* - in: query
* name: master_key
* schema:
* type: integer
* required: true
* example: 10
* responses:
* 200:
* description: success
*/
router.get("/PolicyMasterChildTableData", CreditPolicy.PolicyMasterChildTableData);
//create Policy Master Child Data
/**
* @swagger
* /api/createPolicyMasterChildData:
* post:
* summary: (post method ) need to attach creation object as body
* description:
* parameters:
* - in: query
* name: table_name
* schema:
* type: string
* required: true
* example: financials_norms
* responses:
* 200:
* description: success
*/
router.post("/createPolicyMasterChildData", CreditPolicy.createPolicyMasterChildData);
//update Policy Master Child Data
/**
* @swagger
* /api/updatePolicyMasterChildData:
* post:
* summary: (post method ) need to attach updation object as body
* description:
* parameters:
* - in: query
* name: table_name
* schema:
* type: string
* required: true
* example: financials_norms
* responses:
* 200:
* description: success
*/
router.post("/updatePolicyMasterChildData", CreditPolicy.updatePolicyMasterChildData);
// Parameter Master Data select api
/**
* @swagger
* /api/PolicyMasterData:
* get:
* summary: check Parameter MasterData Api
* description: check Parameter MasterData Api
* responses:
* 200:
* description: success
*/
router.get("/PolicyMasterData", CreditPolicy.PolicyMasterData);
// DoubleWhammy Data List
/**
* @swagger
* /api/DoubleWhammyDataList:
* get:
* summary: DoubleWhammyDataList Api
* description:
* responses:
* 200:
* description: success
*/
router.get("/DoubleWhammyDataList", CreditPolicy.DoubleWhammyDataList);
// DscrLeverageGrid Data List
/**
* @swagger
* /api/DscrLeverageGridDataList:
* get:
* summary: DscrLeverageGridDataList Api
* description:
* responses:
* 200:
* description: success
*/
router.get("/DscrLeverageGridDataList", CreditPolicy.DscrLeverageGridDataList);
// LeverageUsedForEligCat Data List
/**
* @swagger
* /api/LeverageUsedForEligCatDataList:
* get:
* summary: LeverageUsedForEligCatDataList Api
* description:
* responses:
* 200:
* description: success
*/
router.get("/LeverageUsedForEligCatDataList", CreditPolicy.LeverageUsedForEligCatDataList);
/**
* @swagger
* /api/AdjustableTang:
* get:
* summary: check Adjustable Tangible MasterData Api
* description: check Adjustable Tangible MasterData Api
* responses:
* 200:
* description: success
*/
router.get("/AdjustableTang", CreditPolicy.AdjustableTang);
/**
* @swagger
* definitions:
* createPolicyMasterData:
* type: array
* items:
* type: object
* properties:
* section_id:
* type: integer
* description:
* example: 1
* parameter:
* type: string
* description:
* example: test
* rules:
* type: json
* description:
* example: "{key : value } or value"
* data:
* type: integer
* description:
* example: 0
* json:
* type: integer
* description:
* example: 1
* is_active:
* type: integer
* description:
* example: 1
* createdby:
* type: integer
* description:
* example: 1
*/
/**
* @swagger
* /api/createPolicyMasterData:
* post:
* summary:
* description:
* requestBody:
* content:
* application/json:
* schema:
* $ref: '#/definitions/createPolicyMasterData'
* responses:
* 200:
* description: create success
* 500:
* description: failure in create
*/
router.post("/createPolicyMasterData", CreditPolicy.createPolicyMasterData);
/**
* @swagger
* definitions:
* updatePolicyMasterData:
* type: array
* items:
* type: object
* properties:
* id:
* type: integer
* description:
* example: 00
* section_id:
* type: integer
* description:
* example: 1
* parameter:
* type: string
* description:
* example: test
* rules:
* type: json
* description:
* example: "{key : value } or value"
* data:
* type: integer
* description:
* example: 0
* json:
* type: integer
* description:
* example: 1
* is_active:
* type: integer
* description:
* example: 1
* updatedby:
* type: integer
* description:
* example: 1
*/
/**
* @swagger
* /api/updatePolicyMasterData:
* post:
* summary:
* description:
* requestBody:
* content:
* application/json:
* schema:
* $ref: '#/definitions/updatePolicyMasterData'
* responses:
* 200:
* description: update success
* 500:
* description: failure in update
*/
router.post("/updatePolicyMasterData", CreditPolicy.updatePolicyMasterData);
/**
* @swagger
* definitions:
* createDoubleWhammy:
* type: array
* items:
* type: object
* properties:
* program_id:
* type: integer
* description:
* example: 1
* check_type_id:
* type: integer
* description:
* example: 1
* property_type_id:
* type: integer
* description:
* example: 1
* property_usage:
* type: string
* description:
* example: Self Occupied
* eligibility_factor_1:
* type: string
* description:
* example: 125
* eligibility_factor_2:
* type: string
* description:
* example: 133
* eligibility_factor_3:
* type: string
* description:
* example: 143
* eligibility_factor_4:
* type: string
* description:
* example: 154
* eligibility_factor_5:
* type: string
* description:
* example: 167
* result:
* type: string
* description:
* example: Applicable
* is_active:
* type: integer
* description:
* example: 1
* createdby:
* type: integer
* description:
* example: 1
*/
/**
* @swagger
* /api/createDoubleWhammy:
* post:
* summary:
* description:
* requestBody:
* content:
* application/json:
* schema:
* $ref: '#/definitions/createDoubleWhammy'
* responses:
* 200:
* description: update success
* 500:
* description: failure in update
*/
router.post("/createDoubleWhammy", CreditPolicy.createDoubleWhammy);
/**
* @swagger
* definitions:
* updateDoubleWhammy:
* type: array
* items:
* type: object
* properties:
* id:
* type: integer
* description:
* example: 50
* program_id:
* type: integer
* description:
* example: 1
* check_type_id:
* type: integer
* description:
* example: 1
* property_type_id:
* type: integer
* description:
* example: 1
* property_usage:
* type: string
* description:
* example: Self Occupied
* eligibility_factor_1:
* type: string
* description:
* example: 125
* eligibility_factor_2:
* type: string
* description:
* example: 133
* eligibility_factor_3:
* type: string
* description:
* example: 143
* eligibility_factor_4:
* type: string
* description:
* example: 154
* eligibility_factor_5:
* type: string
* description:
* example: 167
* result:
* type: string
* description:
* example: Applicable
* is_active:
* type: integer
* description:
* example: 1
* updatedby:
* type: integer
* description:
* example: 1
*/
/**
* @swagger
* /api/updateDoubleWhammy:
* post:
* summary:
* description:
* requestBody:
* content:
* application/json:
* schema:
* $ref: '#/definitions/updateDoubleWhammy'
* responses:
* 200:
* description: update success
* 500:
* description: failure in update
*/
router.post("/updateDoubleWhammy", CreditPolicy.updateDoubleWhammy);
/**
* @swagger
* definitions:
* createDscrLeverageGrid:
* type: array
* items:
* type: object
* properties:
* program_id:
* type: integer
* description:
* example: 1
* business_activity_id:
* type: integer
* description:
* example: 1
* leverage:
* type: string
* description:
* example: "<=3"
* dscr_min:
* type: string
* description:
* example: ">=0.95"
* dscr_max:
* type: string
* description:
* example: null
* result:
* type: string
* description:
* example: No Deviation
* is_active:
* type: integer
* description:
* example: 1
* createdby:
* type: integer
* description:
* example: 1
*/
/**
* @swagger
* /api/createDscrLeverageGrid:
* post:
* summary:
* description:
* requestBody:
* content:
* application/json:
* schema:
* $ref: '#/definitions/createDscrLeverageGrid'
* responses:
* 200:
* description: create success
* 500:
* description: failure in create
*/
router.post("/createDscrLeverageGrid", CreditPolicy.createDscrLeverageGrid);
/**
* @swagger
* definitions:
* updateDscrLeverageGrid:
* type: array
* items:
* type: object
* properties:
* id:
* type: integer
* description:
* example: 1
* program_id:
* type: integer
* description:
* example: 1
* business_activity_id:
* type: integer
* description:
* example: 1
* leverage:
* type: string
* description:
* example: "<=3"
* dscr_min:
* type: string
* description:
* example: ">=0.95"
* dscr_max:
* type: string
* description:
* example: null
* result:
* type: string
* description:
* example: No Deviation
* is_active:
* type: integer
* description:
* example: 1
* updatedby:
* type: integer
* description:
* example: 1
*/
/**
* @swagger
* /api/updateDscrLeverageGrid:
* post:
* summary:
* description:
* requestBody:
* content:
* application/json:
* schema:
* $ref: '#/definitions/updateDscrLeverageGrid'
* responses:
* 200:
* description: update success
* 500:
* description: failure in update
*/
router.post("/updateDscrLeverageGrid", CreditPolicy.updateDscrLeverageGrid);
/**
* @swagger
* definitions:
* createLeverageUsedForEligCat:
* type: array
* items:
* type: object
* properties:
* program_id:
* type: integer
* description:
* example: 1
* business_activity_id:
* type: integer
* description:
* example: 1
* leverage_value:
* type: integer
* description:
* example: 8
* is_active:
* type: integer
* description:
* example: 1
* createdby:
* type: integer
* description:
* example: 1
*/
/**
* @swagger
* /api/createLeverageUsedForEligCat:
* post:
* summary:
* description:
* requestBody:
* content:
* application/json:
* schema:
* $ref: '#/definitions/createLeverageUsedForEligCat'
* responses:
* 200:
* description: create success
* 500:
* description: failure in create
*/
router.post("/createLeverageUsedForEligCat", CreditPolicy.createLeverageUsedForEligCat);
/**
* @swagger
* definitions:
* updateLeverageUsedForEligCat:
* type: array
* items:
* type: object
* properties:
* id:
* type: integer
* description:
* example: 1
* program_id:
* type: integer
* description:
* example: 1
* business_activity_id:
* type: integer
* description:
* example: 1
* leverage_value:
* type: integer
* description:
* example: 8
* is_active:
* type: integer
* description:
* example: 1
* updatedby:
* type: integer
* description:
* example: 1
*/
/**
* @swagger
* /api/updateLeverageUsedForEligCat:
* post:
* summary:
* description:
* requestBody:
* content:
* application/json:
* schema:
* $ref: '#/definitions/updateLeverageUsedForEligCat'
* responses:
* 200:
* description: update success
* 500:
* description: failure in update
*/
router.post("/updateLeverageUsedForEligCat", CreditPolicy.updateLeverageUsedForEligCat);
/**
* @swagger
* definitions:
* createAdjustableTang:
* type: array
* items:
* type: object
* properties:
* property_ownership_document_available:
* type: string
* description:
* example: "Yes"
* type_of_property:
* type: string
* description:
* example: "Residential"
* property_used_in_business:
* type: string
* description:
* example: "Yes"
* property_free_loan_taken:
* type: string
* description:
* example: "No Loan on Property - Property Not on BS"
* property_in_the_name_of_applicant:
* type: string
* description:
* example: "Yes"
* loan_obligated_in_cet:
* type: string
* description:
* example: "Yes"
* property_created_in_last_eight_yr:
* type: string
* description:
* example: "Yes"
* value_to_be_considered:
* type: string
* description:
* example: "market_valuation_rs"
* mv_to_be_added_to_atnw:
* type: integer
* description:
* example: 100
* final_value_considered:
* type: string
* description:
* example: "(value_to_be_considered * mv_to_be_added_to_atnw )"
* is_active:
* type: integer
* description:
* example: 1
* createdby:
* type: integer
* description:
* example: 1
*/
/**
* @swagger
* /api/createAdjustableTang:
* post:
* summary:
* description:
* requestBody:
* content:
* application/json:
* schema:
* $ref: '#/definitions/createAdjustableTang'
* responses:
* 200:
* description: create success
* 500:
* description: failure in create
*/
router.post("/createAdjustableTang", CreditPolicy.createAdjustableTang);
/**
* @swagger
* definitions:
* updateAdjustableTang:
* type: array
* items:
* type: object
* properties:
* id:
* type: integer
* description:
* example: 806
* property_ownership_document_available:
* type: string
* description:
* example: "Yes"
* type_of_property:
* type: string
* description:
* example: "Residential"
* property_used_in_business:
* type: string
* description:
* example: "Yes"
* property_free_loan_taken:
* type: string
* description:
* example: "No Loan on Property - Property Not on BS"
* property_in_the_name_of_applicant:
* type: string
* description:
* example: "Yes"
* loan_obligated_in_cet:
* type: string
* description:
* example: "Yes"
* property_created_in_last_eight_yr:
* type: string
* description:
* example: "Yes"
* value_to_be_considered:
* type: string
* description:
* example: "market_valuation_rs"
* mv_to_be_added_to_atnw:
* type: integer
* description:
* example: 100
* final_value_considered:
* type: string
* description:
* example: "(value_to_be_considered * mv_to_be_added_to_atnw )"
* is_active:
* type: integer
* description:
* example: 1
* updatedby:
* type: integer
* description:
* example: 1
*/
/**
* @swagger
* /api/updateAdjustableTang:
* post:
* summary:
* description:
* requestBody:
* content:
* application/json:
* schema:
* $ref: '#/definitions/updateAdjustableTang'
* responses:
* 200:
* description: update success
* 500:
* description: failure in update
*/
router.post("/updateAdjustableTang", CreditPolicy.updateAdjustableTang);
// TokenApi
/**
* @swagger
* /api/TokenApi:
* get:
* summary: Token for Banking and Cibil Api
* description: Token for Banking and Cibil Api
* responses:
* 200:
* description: success
*/
router.get("/TokenApi", CreditPolicy.TokenApi);
router.get("/getfilename", Mycontroller.readLogFileName);
router.post("/readlogs", Mycontroller.readLogFile);
router.get("/view", Mycontroller.viewLandingPage);
router.post("/deletelog", Mycontroller.deleteLogFile);
// routes started here
app.use('/api', router);
};