-
Notifications
You must be signed in to change notification settings - Fork 5
/
routes.ts
173 lines (147 loc) · 9.51 KB
/
routes.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
import UserController from './controllers/userController';
import AuthController from './controllers/authController';
import SectionController from './controllers/sectionController';
import StandardController from './controllers/standardController';
import StudentController from './controllers/studentController';
import TeacherController from './controllers/teacherController';
import CounsellorController from './controllers/counsellorController';
import TransportManagerController from './controllers/transportManagerController';
import FinanceManagerController from './controllers/financeManagerController';
import PrincipalController from './controllers/principalController';
import StationeryController from './controllers/stationeryController';
import FeeController from './controllers/feeController';
import BusRouteController from './controllers/busRouteController';
import StationeryUnitController from './controllers/stationeryUnitController';
import AttendanceController from './controllers/attendanceController';
import * as verifyToken from './controllers/verifyToken';
export default function setRoutes (app) {
const userCtrl = new UserController();
const authCtrl = new AuthController();
const standardCtrl = new StandardController();
const sectionCtrl = new SectionController();
const studentCtrl = new StudentController();
const teacherCtrl = new TeacherController();
const counsellorCtrl = new CounsellorController();
const financeMngrCtrl = new FinanceManagerController();
const transportMngrCtrl = new TransportManagerController();
const principalCtrl = new PrincipalController();
const stationeryCtrl = new StationeryController();
const feeCtrl = new FeeController();
const busRouteCtrl = new BusRouteController();
const stationeryUnitCtrl = new StationeryUnitController();
const attendanceCtrl = new AttendanceController();
//-------------------------
// Auth APIs
//-------------------------
app.route('/api/auth/login').post(authCtrl.login);
app.route('/api/auth/signup').post(authCtrl.signup);
app.route('/api/auth/forgot-password').post(authCtrl.resetPassword);
//-------------------------
// Dashboard APIs
//-------------------------
app.route('/api/totalstudents').get(verifyToken, studentCtrl.getTotalStudents);
app.route('/api/totalteachers').get(verifyToken, teacherCtrl.getTotalTeachers);
//-------------------------
// User APIs
//-------------------------
app.route('/api/users').get(verifyToken, userCtrl.getAll); // get all users
app.route('/api/user/:id').get(verifyToken, userCtrl.get); // get user by id
app.route('/api/user/:id').put(verifyToken, userCtrl.update); // update user by id
app.route('/api/user').post(verifyToken, userCtrl.addUser); // save user
app.route('/api/user/:id').delete(verifyToken, userCtrl.delete); // delete user by id
app.route('/api/user').get(verifyToken, userCtrl.getUserByToken); // get user by token
app.route('/api/user').put(verifyToken, userCtrl.updateUserByToken); // update user by token
app.route('/api/reset-password').post(verifyToken, userCtrl.resetPassword); // update password by token
//----------------------------------
// Student APIs
//----------------------------------
app.route('/api/students/all').post(verifyToken, studentCtrl.getStudents); // get all students
app.route('/api/student/:id').get(verifyToken, studentCtrl.getStudentById); // get student by id
//---------------------------------------
// Teacher APIs
//--------------------------------------
app.route('/api/teachers/all').post(verifyToken, teacherCtrl.getTeachers); // get all teachers
app.route('/api/teacher/:id').get(verifyToken, teacherCtrl.getUserById); // get teacher by id
//---------------------------------------
// Counsellor APIs
//--------------------------------------
app.route('/api/counsellors/all').post(verifyToken, counsellorCtrl.getCounsellors); // get all counsellors
app.route('/api/counsellor/:id').get(verifyToken, counsellorCtrl.getUserById); // get counsellor by id
//---------------------------------------
// Finance Manager APIs
//--------------------------------------
app.route('/api/financeManagers/all').post(verifyToken, financeMngrCtrl.getFinanceManagers); // get all finance managers
app.route('/api/financeManager/:id').get(verifyToken, financeMngrCtrl.getUserById); // get finance manager by id
//---------------------------------------
// Transport Manager APIs
//--------------------------------------
app.route('/api/transportManagers/all').post(verifyToken, transportMngrCtrl.getTransportManagers); // get all transport managers
app.route('/api/transportManager/:id').get(verifyToken, transportMngrCtrl.getUserById); // get transport manager by id
//---------------------------------------
// Principal APIs
//--------------------------------------
app.route('/api/principal').get(verifyToken, principalCtrl.getUsers); // get principal
app.route('/api/principal/:id').get(verifyToken, principalCtrl.getUserById); // get principal by id
//-------------------------
// Standard APIs
//-------------------------
app.route('/api/standards').get(verifyToken, standardCtrl.getAll); // get all standards
app.route('/api/standard/:id').get(verifyToken, standardCtrl.get); // get standard by id
app.route('/api/standard/:id').put(verifyToken, standardCtrl.update); // update standard by id
app.route('/api/standard').post(verifyToken, standardCtrl.insert); // save standard
app.route('/api/standard/:id').delete(verifyToken, standardCtrl.delete); // delete standard by id
//-------------------------
// Section APIs
//-------------------------
app.route('/api/sections').get(verifyToken, sectionCtrl.getAll); // get all sections
app.route('/api/section/:id').get(verifyToken, sectionCtrl.get); // get section by id
app.route('/api/section/:id').put(verifyToken, sectionCtrl.update); // update section by id
app.route('/api/section').post(verifyToken, sectionCtrl.insert); // save section
app.route('/api/section/:id').delete(verifyToken, sectionCtrl.delete); // delete section by id
//-------------------------
// Stationery APIs
//-------------------------
app.route('/api/stationery').get(verifyToken, stationeryCtrl.getAll); // get all stationery items
app.route('/api/stationery/:id').get(verifyToken, stationeryCtrl.get); // get stationery by id
app.route('/api/stationery/:id').put(verifyToken, stationeryCtrl.update); // update stationery by id
app.route('/api/stationery').post(verifyToken, stationeryCtrl.insert); // save stationery
app.route('/api/stationery/:id').delete(verifyToken, stationeryCtrl.delete); // delete stationery by id
//-------------------------
// Stationery Unit APIs
//-------------------------
app.route('/api/stationeryunit').post(verifyToken, stationeryUnitCtrl.getStationary); // get all stationery items
app.route('/api/stationeryunit/:id').get(verifyToken, stationeryUnitCtrl.get); // get stationery by id
app.route('/api/stationeryunit/:id').put(verifyToken, stationeryUnitCtrl.update); // update stationery by id
app.route('/api/stationeryunit').post(verifyToken, stationeryUnitCtrl.insert); // save stationery
app.route('/api/stationeryunit/:id').delete(verifyToken, stationeryUnitCtrl.delete); // delete stationery by id
//-------------------------
// Attendance APIs
//-------------------------
app.route('/api/attendance').post(verifyToken, attendanceCtrl.getAttendence); // get all attendance
app.route('/api/attendance/:id').get(verifyToken, attendanceCtrl.get); // get attendance by id
app.route('/api/attendance/:id').put(verifyToken, attendanceCtrl.update); // update attendance by id
app.route('/api/attendanceadd').post(verifyToken, attendanceCtrl.insert); // save attendance
app.route('/api/attendance/:id').delete(verifyToken, attendanceCtrl.delete); // delete attendance by id
app.route('/api/attendance/standard/:standard/:section/:date').get(verifyToken, attendanceCtrl.getAttendanceByStandard);//get attendance by standard and section
app.route('/api/attendance/update').post(verifyToken, attendanceCtrl.updateAttendance);//update attendance by user and date
//-------------------------
// Fee APIs
//-------------------------
app.route('/api/fees').get(verifyToken, feeCtrl.getAll); // get all fees
app.route('/api/fee/:id').get(verifyToken, feeCtrl.get); // get fee by id
app.route('/api/fee/:id').put(verifyToken, feeCtrl.update); // update fee by id
app.route('/api/fee').post(verifyToken, feeCtrl.insert); // save fee
app.route('/api/fee/:id').delete(verifyToken, feeCtrl.delete); // delete fee by id
//-------------------------
// Bus Route APIs
//-------------------------
app.route('/api/busRoutes').get(verifyToken, busRouteCtrl.getAll); // get all bus routes
app.route('/api/busRoute/:id').get(verifyToken, busRouteCtrl.get); // get bus route by id
app.route('/api/busRoute/:id').put(verifyToken, busRouteCtrl.update); // update bus route by id
app.route('/api/busRoute').post(verifyToken, busRouteCtrl.insert); // save bus route
app.route('/api/busRoute/:id').delete(verifyToken, busRouteCtrl.delete); // delete bus route by id
// --------------------------------
// User Profile Image APIs
// --------------------------------
app.route('/api/user/getProfileImage/:id').get(verifyToken, userCtrl.getProfileImage);
}