-
Notifications
You must be signed in to change notification settings - Fork 0
/
routes.py
269 lines (169 loc) · 6.62 KB
/
routes.py
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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
from flask import Blueprint
# Import Request Handler Classes
from app.request_handler import CommonRequestHandler, OwnerRequestHandler, CustomerRequestHandler, OperatorRequestHandler, CustomCommonRequestHandler, APIRequstHandler
requestRoutes = Blueprint('request_routes', __name__)
# Start Routes
# COMMON BEGIN
@requestRoutes.route('/index')
@requestRoutes.route('/')
def index():
return CommonRequestHandler().index()
@requestRoutes.route('/bookbus')
def bookbus():
return CommonRequestHandler().bookbus()
@requestRoutes.route('/details')
def details():
return CommonRequestHandler().details()
@requestRoutes.route('/ticket')
def ticket():
return CommonRequestHandler().ticket()
# for selection of sign up type
@requestRoutes.route('/choosesignup')
def chooseSignUp():
return CommonRequestHandler().chooseSignUp()
# Actual signup (Owner / Operator / Customer)
@requestRoutes.route('/signup/<role>', methods=['GET', 'POST'])
def signUp(role):
return CommonRequestHandler().signUp(role= role)
# for selection of login type
@requestRoutes.route('/chooselogin', methods=['GET'])
def chooseLogin():
return CommonRequestHandler().chooseLogin()
# Actual Login of type (Owner / Operator / Customer)
@requestRoutes.route('/login/<role>', methods=['GET', 'POST'])
def login(role):
return CommonRequestHandler().login(role= role)
# logout works with visiting url via POST, no Type needed
@requestRoutes.route('/logout', methods=['POST'])
def logout():
return CommonRequestHandler().logout()
@requestRoutes.route('/changepassword', methods=['GET', 'POST'])
def changePassword():
return CommonRequestHandler().changePassword()
@requestRoutes.route('/viewbookingdetails/<uuid:bookingId>', methods=['GET'])
def viewBookingDetails(bookingId):
return CustomerRequestHandler().viewBookingDetails(bookingId= bookingId)
# View All Schedules (works with filters => (see ComplexOperation))
@requestRoutes.route('/viewschedules', methods=['GET', 'POST'])
def viewSchedules():
return CustomCommonRequestHandler().viewSchedules()
@requestRoutes.route('/layout')
def layout():
return CommonRequestHandler().layout()
# fallback handler in case of not found (404)
@requestRoutes.app_errorhandler(404)
def pageNotFound(e):
return CommonRequestHandler().pageNotFound(e= e)
# COMMON END
# OWNER BEGIN
# Landing Page for Owner
@requestRoutes.route('/landingowner')
def landingOwner():
return OwnerRequestHandler().landingOwner()
# Bus Registration
@requestRoutes.route('/addbus', methods=['GET', 'POST'])
def addBus():
return OwnerRequestHandler().addBus()
# View All registered bus of the Owner
@requestRoutes.route('/viewbus', methods=['GET'])
def viewBus():
return OwnerRequestHandler().viewBus()
# View Specific Bus Details
@requestRoutes.route('/viewbusdetails', methods=['POST'])
def viewBusDetails():
return OwnerRequestHandler().viewBusDetails()
# Register Operator
@requestRoutes.route('/registeroperator', methods=['GET', 'POST'])
def registerOperator():
return OwnerRequestHandler().registerOperator()
@requestRoutes.route('/viewoperator', methods=['GET'])
def viewOperator():
return OwnerRequestHandler().viewOperator()
# Update Owners profile
@requestRoutes.route('/updateownerprofile', methods=['GET', 'POST'])
def updateOwnerProfile():
return OwnerRequestHandler().updateOwnerProfile()
# View all registered Cities
@requestRoutes.route('/viewcity', methods=['GET', 'POST'])
def viewCity():
return OwnerRequestHandler().viewCity()
# Register a City
@requestRoutes.route('/addcity', methods=['GET', 'POST'])
def addCity():
return OwnerRequestHandler().addCity()
# View all regisited Stop
@requestRoutes.route('/viewstop', methods=['GET', 'POST'])
def viewStop():
return OwnerRequestHandler().viewStop()
# Register a Stop
@requestRoutes.route('/addstop', methods=['GET', 'POST'])
def addStop():
return OwnerRequestHandler().addStop()
# Add A new schedule
@requestRoutes.route('/addschedule', methods=['GET', 'POST'])
def addSchedule():
return OwnerRequestHandler().addSchedule()
# View a Schedule in detail
@requestRoutes.route('/viewscheduledetails', methods=['GET', 'POST'])
def viewScheduleDetails():
return OwnerRequestHandler().viewScheduleDetails()
# Update a Schedules Stops
@requestRoutes.route('/updatestops', methods=['POST'])
def updateStops():
return OwnerRequestHandler().updateStops()
@requestRoutes.route('/updatetripstatus', methods=['POST'])
def updateTripStatus():
return OwnerRequestHandler().updateTripStatus()
# OWNER END
# OPERATOR BEGIN
# Landing Page for Operator
@requestRoutes.route('/landingoperator')
def landingOperator():
return OperatorRequestHandler().landingOperator()
# Update Operators profile
@requestRoutes.route('/updateoperatorprofile', methods=['GET', 'POST'])
def updateOperatorProfile():
return OperatorRequestHandler().updateOperatorProfile()
# View all Operator's Assigned Schedules
@requestRoutes.route('/viewoperatorschedules', methods=['GET'])
def viewOperatorSchedules():
return OperatorRequestHandler().viewOperatorSchedules()
@requestRoutes.route('/viewoperatorscheduledetails', methods=['POST'])
def viewOperatorScheduleDetails():
return OperatorRequestHandler().viewOperatorScheduleDetails()
# OPERATOR END
# CUSTOMER BEGIN
# Landing Page for Customer
@requestRoutes.route('/landingcustomer')
def landingCustomer():
return CustomerRequestHandler().landingCustomer()
# Update Customer profile
@requestRoutes.route('/updatecustomerprofile', methods=['GET', 'POST'])
def updateCustomerProfile():
return CustomerRequestHandler().updateCustomerProfile()
@requestRoutes.route('/registerpassenger', methods=['GET', 'POST'])
def registerPassenger():
return CustomerRequestHandler().registerPassenger()
@requestRoutes.route('/viewpassengers', methods=['GET'])
def viewPassengers():
return CustomerRequestHandler().viewPassengers()
@requestRoutes.route('/bookschedule', methods=['POST'])
def bookSchedule():
return CustomerRequestHandler().bookSchedule()
@requestRoutes.route('/confirmbookschedule', methods=['POST'])
def confirmBookSchedule():
return CustomerRequestHandler().confirmBookSchedule()
@requestRoutes.route('/viewbooking', methods=['GET'])
def viewBookings():
return CustomerRequestHandler().viewBookings()
# CUSTOMER END
# API BEGIN
# API For getting all stops in cities
@requestRoutes.route('/getstopsbycity')
def getStopsByCity():
return APIRequstHandler().getStopsByCity()
# View Specific Bus Details API
@requestRoutes.route('/getbusdetails', methods=['POST'])
def getBusDetails():
return APIRequstHandler().getBusDetails()
# API END