prod125njac/prod125njac-back-b/authsec_node/Backend/routes/cns.router.js

366 lines
7.8 KiB
JavaScript

const {
login,
getUsersUserGrpMaintenance,
getUsersByUserIdUserGrpMaintenance,
updateUsersUserGrpMaintenance,
createUsersUserGrpMaintenance,
deleteUsersUserGrpMaintenance,
getUsersMenuMaintainence,
getUsersByUserIdMenuMaintainence,
createUsersMenuMaintainence,
updateUsersMenuMaintainence,
deleteUsersMenuMaintainence,
getUsersByIdSubMenuMaintainence,
createUsersMenuAccessControl,
getUsersMenuAccessControl,
getUserMaintainence,
getByIdUserMaintainence,
createUserMaintainence,
updateUserMaintainence,
loadMenuByUser,
userMenu,
createReport,
getAllReportBuilder,
getAllReportBuilderById,
getAllReportBuilderByQuery,
updateReportBuilder,
deleteReportBuilder,
getReportLine,
getReportLineById,
updateReportLine,
getAllDashboard,
getDashboardByModuleId,
getAllDashboardHeaderById,
createDashboard,
updateDashboard,
deleteDashboard,
getDashboardLine,
getDashboardLineById,
updateDashboardLineById,
getSystemParameterById,
getSystemParameter,
createSystemParameter,
updateSystemParameter,
deleteSystemParameter,
getLogs,
getAllFormExtension,
getByIdFormExtension,
createFormExtension,
updateFormExtension,
deleteFormExtension,
buildExtension,
logout,
sendEmailForResetPassword,
resetPassword,
savePassword,
getLoggedInUser,
uploadProfilePhoto,
retrieveProfilePhoto,
test,
} = require("../api/cns.controller")
const {
getAllUserNode,
addUserUserNode,
getByNameUserNode,
} = require("../listBuilder/controller")
// const { checkToken } = require("../auth/token_validation")
const { authenticateJWT } = require("../middleware/authenticateJWT")
const userLogger = require("../middleware/userLogger")
const uploadMiddleware = require("../middleware/uploadMiddleware")
const router = require("express").Router()
router.get("/test/:id", test)
router.post("/token/session", login)
router.post("/api/resources/forgotpassword", sendEmailForResetPassword)
router.post("/api/resources/savePassword/:token", savePassword)
router.post("/api/reset_password", authenticateJWT, userLogger, resetPassword)
router.get("/api/user-profile", authenticateJWT, userLogger, getLoggedInUser)
router.put(
"/api/user-profile",
authenticateJWT,
userLogger,
updateUserMaintainence
)
// profile photo upload and retrieve
router
.post(
"/api/upload",
authenticateJWT,
userLogger,
uploadMiddleware,
uploadProfilePhoto
)
.get("/api/retrieve-image", authenticateJWT, userLogger, retrieveProfilePhoto)
router.get("/token/logout", authenticateJWT, userLogger, logout)
// Api for sec user group
router
.get(
"/api/getAllUsrGrp",
authenticateJWT,
userLogger,
getUsersUserGrpMaintenance
)
// .get(
// "/api1/getusracces1/:id",
// authenticateJWT,
// userLogger,
// getUsersByUserIdUserGrpMaintenance
// )
.put(
"/api/updateOneUsrGrp/:id",
authenticateJWT,
userLogger,
updateUsersUserGrpMaintenance
)
.post(
"/api/addOneUsrGrp",
authenticateJWT,
userLogger,
createUsersUserGrpMaintenance
)
.delete(
"/api/delete_usrgrp/:id",
authenticateJWT,
userLogger,
deleteUsersUserGrpMaintenance
)
router
.get("/api1/submenu1", authenticateJWT, userLogger, getUsersMenuMaintainence)
.get(
"/api1/getusracces1/:id",
authenticateJWT,
userLogger,
getUsersByUserIdMenuMaintainence
)
.post(
"/api1/Sec_menuDet",
authenticateJWT,
userLogger,
createUsersMenuMaintainence
)
.put(
"/api1/submenu1/:id",
authenticateJWT,
userLogger,
updateUsersMenuMaintainence
)
.delete(
"/api1/menu/:id",
authenticateJWT,
userLogger,
deleteUsersMenuMaintainence
)
// // Report Builder Controller
router
.post(
"/Rpt_builder2/Rpt_builder2",
authenticateJWT,
userLogger,
createReport
)
router
.get(
"/Rpt_builder2/Rpt_builder2",
authenticateJWT,
userLogger,
getAllReportBuilder
)
.get(
"/Rpt_builder2/Rpt_builder2/:id",
authenticateJWT,
userLogger,
getAllReportBuilderById
)
.get(
"/api/master-query-data/:query",
authenticateJWT,
userLogger,
getAllReportBuilderByQuery
)
.put(
"/Rpt_builder2/Rpt_builder2/:id",
authenticateJWT,
userLogger,
updateReportBuilder
)
.delete(
"/Rpt_builder2/Rpt_builder2/:id",
authenticateJWT,
userLogger,
deleteReportBuilder
)
// // Report Line Controller
router
.get(
"/Rpt_builder2_lines/Rpt_builder2_lines",
authenticateJWT,
userLogger,
getReportLine
)
.get(
"/Rpt_builder2_lines/Rpt_builder2_lines/:id",
authenticateJWT,
userLogger,
getReportLineById
)
.put(
"/Rpt_builder2_lines/update/:id",
authenticateJWT,
userLogger,
updateReportLine
)
// // Dashboard Controller
router
.get("/get_Dashboard_header", authenticateJWT, userLogger, getAllDashboard)
.get("/get_module_id", authenticateJWT, userLogger, getDashboardByModuleId)
.get(
"/get_dashboard_headerbyid/:id",
authenticateJWT,
userLogger,
getAllDashboardHeaderById
)
.post("/Savedata", authenticateJWT, userLogger, createDashboard)
.put(
"/update_dashboard_header/:id",
authenticateJWT,
userLogger,
updateDashboard
)
.delete(
"/delete_by_header_id/:id",
authenticateJWT,
userLogger,
deleteDashboard
)
// // Dashboard Line Controller
router
.get("/get_Dashboard1_line", authenticateJWT, userLogger, getDashboardLine)
.get(
"/get_dashboard_headerbyid/:id",
authenticateJWT,
userLogger,
getDashboardLineById
)
.put(
"/update_Dashbord1_Lineby_id/:id",
authenticateJWT,
userLogger,
updateDashboardLineById
)
// // System Parameter router
router
.get(
"/sysparam/getSysParams",
authenticateJWT,
userLogger,
getSystemParameter
)
.get(
"/sysparam/getSysParams/:id",
authenticateJWT,
userLogger,
getSystemParameterById
)
.post(
"/sysparam/addSysParams",
authenticateJWT,
userLogger,
createSystemParameter
)
.put(
"/sysparam/updateSysParams/:id",
authenticateJWT,
userLogger,
updateSystemParameter
)
.delete(
"/sysparam/deleteSysParams/:id",
authenticateJWT,
userLogger,
deleteSystemParameter
)
// // Form extension router
router
.get("/api/extension", authenticateJWT, userLogger, getAllFormExtension)
.get("/api/extension/:id", authenticateJWT, userLogger, getByIdFormExtension)
.get("/extension_build/:formId", authenticateJWT, userLogger, buildExtension)
.post("/api/extension/", authenticateJWT, userLogger, createFormExtension)
.put("/api/extension/:id", authenticateJWT, userLogger, updateFormExtension)
.delete(
"/api/extension/:id",
authenticateJWT,
userLogger,
deleteFormExtension
)
//// User Node Table router
router
.get("/user/node", authenticateJWT, userLogger, getAllUserNode)
.get("/user/node/:name", authenticateJWT, userLogger, getByNameUserNode)
.post("/user/node", authenticateJWT, userLogger, addUserUserNode)
router.get(
"/api1/submenu1/:id",
authenticateJWT,
userLogger,
getUsersByIdSubMenuMaintainence
)
// api for sec group menu access
router
.get(
"/api/getAllUsrGrp",
authenticateJWT,
userLogger,
getUsersMenuAccessControl
)
.post(
"/api1/addgrpwithsubmenu/:id",
authenticateJWT,
userLogger,
createUsersMenuAccessControl
)
router
.get("/api/getAllAppUser", authenticateJWT, userLogger, getUserMaintainence)
.get(
"/api/getOneAppUser/:id",
authenticateJWT,
userLogger,
getByIdUserMaintainence
)
.post("/api/addOneAppUser", createUserMaintainence)
router.get(
"/fndMenu/menuloadbyuser",
authenticateJWT,
userLogger,
loadMenuByUser
)
router.get("/api/realnet-menu/user-menu", authenticateJWT, userLogger, userMenu)
router.get("/getLogs/:userName", authenticateJWT, userLogger, getLogs)
module.exports = router