Skip to content

Commit

Permalink
Merge pull request #7 from Twinn-github09/refactor
Browse files Browse the repository at this point in the history
Refactor code
  • Loading branch information
Ashrockzzz2003 authored Jan 7, 2025
2 parents 0f748c6 + 59510a3 commit 9615cac
Show file tree
Hide file tree
Showing 9 changed files with 2,041 additions and 2,064 deletions.
624 changes: 624 additions & 0 deletions controller/auth.js

Large diffs are not rendered by default.

924 changes: 924 additions & 0 deletions controller/manager.js

Large diffs are not rendered by default.

432 changes: 432 additions & 0 deletions controller/student.js

Large diffs are not rendered by default.

2,025 changes: 0 additions & 2,025 deletions controller/userWebController.js

This file was deleted.

13 changes: 11 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ const reInitDatabase = require("./schema/reInitDatabase");
const server = express();
const cors = require('cors');

const userWebRouter = require('./routes/userWeb');
const authrouter = require('./routes/auth.js');
const studentrouter = require('./routes/student.js');
const managerrouter = require('./routes/manager.js');

const { generateKey } = require('./RSA/keyGen');

Expand All @@ -27,7 +29,14 @@ server.use(express.json());
server.use(cors());
server.disable('x-powered-by');

server.use('/api', userWebRouter);
// server.use('api/auth', authrouter);
// server.use('api/student', studentrouter);
// server.use('api/manager', managerrouter);
// New routes
server.use('/api/auth', authrouter);
server.use('/api/student', studentrouter);
server.use('/api/manager', managerrouter);


if (cluster.isPrimary) {
console.log(`[MESSAGE]: Master ${process.pid} is running.`);
Expand Down
16 changes: 16 additions & 0 deletions routes/auth.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const express = require('express')
const router = express.Router();
const authcontroll = require('../controller/auth');

router.get('/test', authcontroll.test);

router.post('/studentRegister', authcontroll.studentRegister);
router.post('/studentLoginVerify', authcontroll.studentVerify);

router.post('/login', authcontroll.userLogin);
router.post('/loginVerify', authcontroll.loginVerify);
router.post('/forgotPassword', authcontroll.forgotPassword);
router.post('/resetPasswordVerify', authcontroll.resetPasswordVerify);
router.post('/resetPassword', authcontroll.resetPassword);

module.exports = router
22 changes: 22 additions & 0 deletions routes/manager.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
const express = require('express')
const router = express.Router();
const managercontroll = require('../controller/manager');

router.get('/test', managercontroll.test);

router.post('/toggleOfficialStatus', managercontroll.toggleOfficialAccountStatus);
router.get('/getRegisteredOfficials', managercontroll.getRegisteredOfficials);
router.post('/registerOfficial', managercontroll.registerOfficial);

router.post('/addCompany', managercontroll.addCompany);
router.get('/getCompanies', managercontroll.getCompanies);

router.get('/getTopFivePlacements',managercontroll.getTop5Placements);
router.post('/addPlacementData', managercontroll.addPlacementData);
router.post('/editPlacementDataById', managercontroll.editPlacementDataById);

router.get('/getCompanyHireData',managercontroll.getCompanyHireData);
router.post('/getCompanyHireDataByBatch',managercontroll.getCompanyHireDatabyBatch);
router.post('/getCompanyHireDataById',managercontroll.getCompanyHireDataById);

module.exports = router;
12 changes: 12 additions & 0 deletions routes/student.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const express = require('express')
const router = express.Router();
const studentcontroll = require('../controller/student');

router.post('/studentEditData', studentcontroll.studentEditData);
router.post('/addStudent', studentcontroll.addStudent);

router.post('/getStudentPlacements', studentcontroll.getStudentPlacements);
router.post('/getAllStudentData',studentcontroll.getAllStudentData);
router.post('/getAllPlacedStudentData',studentcontroll.getAllPlacedStudentsData);

module.exports = router;
37 changes: 0 additions & 37 deletions routes/userWeb.js

This file was deleted.

0 comments on commit 9615cac

Please sign in to comment.