-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
finished admin eventrequests, violations routes #35
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,10 +22,11 @@ | |
|
||
// Parses cookies attached to the client request object | ||
const cookieParser = require('cookie-parser'); | ||
app.use(cookieParser()); | ||
Check failure Code scanning / CodeQL Missing CSRF middleware High
This cookie middleware is serving a
request handler Error loading related location Loading This cookie middleware is serving a request handler Error loading related location Loading This cookie middleware is serving a request handler Error loading related location Loading This cookie middleware is serving a request handler Error loading related location Loading This cookie middleware is serving a request handler Error loading related location Loading This cookie middleware is serving a request handler Error loading related location Loading This cookie middleware is serving a request handler Error loading related location Loading This cookie middleware is serving a request handler Error loading related location Loading This cookie middleware is serving a request handler without CSRF protection. This cookie middleware is serving a request handler without CSRF protection. |
||
|
||
// Import router objects and direct the app to use them | ||
const VendorRouter = require('./routes/VendorRouter'); | ||
const AdminRouter = require('./routes/AdminRouter'); | ||
const EventRouter = require('./routes/EventRouter'); | ||
const AdminRouter = require('./routes/AdminRouter'); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,48 @@ | ||
const express = require('express'); | ||
const router = express.Router(); | ||
|
||
// Auth Controller Imports | ||
const { | ||
verifyAdminToken, | ||
signAdminToken, | ||
verify, | ||
} = require('../controllers/AuthController'); | ||
const {getAdminByEmail, createAdminMiddleware} = require('../controllers/AdminController'); | ||
|
||
// Import express | ||
const express = require('express'); | ||
// Admin Controller Imports | ||
const { | ||
getEventRequests, | ||
getAllEventRequests, | ||
getViolations, | ||
getAllViolations, | ||
createVendorViolation, | ||
deleteVendorViolation, | ||
processEventRequest, | ||
getAdminByEmail, | ||
createAdminMiddleware, | ||
} = require('../controllers/AdminController'); | ||
|
||
// Create a router for admin authentication | ||
const router = express.Router(); | ||
const sendSuccessResponse = require('../middleware/successResponse'); | ||
|
||
router.get('/events/requests/:eventId', verify('admin'), getEventRequests, sendSuccessResponse); | ||
Check failure Code scanning / CodeQL Missing rate limiting High
This route handler performs
a database access Error loading related location Loading |
||
|
||
router.get('/events/requests', verify('admin'), getAllEventRequests, sendSuccessResponse); | ||
Check failure Code scanning / CodeQL Missing rate limiting High
This route handler performs
authorization Error loading related location Loading This route handler performs authorization Error loading related location Loading This route handler performs authorization, but is not rate-limited. This route handler performs authorization, but is not rate-limited. Check failure Code scanning / CodeQL Missing rate limiting High
This route handler performs
a database access Error loading related location Loading |
||
|
||
router.get('/violations/:vendorId', verify('admin'), getViolations, sendSuccessResponse); | ||
Check failure Code scanning / CodeQL Missing rate limiting High
This route handler performs
authorization Error loading related location Loading This route handler performs authorization Error loading related location Loading Check failure Code scanning / CodeQL Missing rate limiting High
This route handler performs
a database access Error loading related location Loading |
||
|
||
router.get('/violations', verify('admin'), getAllViolations, sendSuccessResponse); | ||
Check failure Code scanning / CodeQL Missing rate limiting High
This route handler performs
authorization Error loading related location Loading This route handler performs authorization Error loading related location Loading Check failure Code scanning / CodeQL Missing rate limiting High
This route handler performs
a database access Error loading related location Loading |
||
|
||
router.put('events/requests/:requestId', verify('admin'), processEventRequest, sendSuccessResponse); | ||
Check failure Code scanning / CodeQL Missing rate limiting High
This route handler performs
authorization Error loading related location Loading This route handler performs authorization Error loading related location Loading Check failure Code scanning / CodeQL Missing rate limiting High
This route handler performs
a database access Error loading related location Loading |
||
|
||
router.post('/violations/:vendorId', verify('admin'), createVendorViolation, sendSuccessResponse); | ||
Check failure Code scanning / CodeQL Missing rate limiting High
This route handler performs
authorization Error loading related location Loading This route handler performs authorization Error loading related location Loading Check failure Code scanning / CodeQL Missing rate limiting High
This route handler performs
a database access Error loading related location Loading |
||
|
||
router.delete('/violations/:violationId', verify('admin'), deleteVendorViolation, sendSuccessResponse); | ||
Check failure Code scanning / CodeQL Missing rate limiting High
This route handler performs
authorization Error loading related location Loading This route handler performs authorization Error loading related location Loading This route handler performs authorization, but is not rate-limited. This route handler performs authorization, but is not rate-limited. Check failure Code scanning / CodeQL Missing rate limiting High
This route handler performs
a database access Error loading related location Loading |
||
|
||
router.post('/login', getAdminByEmail, signAdminToken, (req, res) => { | ||
res.status(200).json({status: 'success'}); | ||
}); | ||
|
||
// UNFINISHED: Create an admin account | ||
// Useful for creating an admin account for testing purposes. Password in database needs to be hashed for login to work properly. | ||
// router.post('/', createAdminMiddleware, (req, res) => { | ||
// res.status(200).json({status: 'success', admin: res.locals.data}); | ||
// }); | ||
|
Check failure
Code scanning / CodeQL
Missing rate limiting High