mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 03:20:13 +08:00
feat: add validation before creating session
This commit is contained in:
1 parent
bcfdf15559
commit
d4000eb5a6
3 files changed
+26
-4
No files matched your search
@@ -1,12 +1,25 @@
|
||||
import { Router } from 'express'
|
||||
import * as sessionController from '../controllers/sessionController.js'
|
||||
import { sessionRateLimit } from '../../middleware/rateLimiter.js'
|
||||
import {
|
||||
createSessionValidator,
|
||||
activeSessionValidator,
|
||||
} from '../validators/sessionValidator.js'
|
||||
|
||||
const router = Router()
|
||||
|
||||
router.get('/', sessionController.getSessionList)
|
||||
router.post('/', sessionRateLimit, sessionController.createSession)
|
||||
router.post('/active', sessionController.getOrCreateSession)
|
||||
router.post(
|
||||
'/',
|
||||
createSessionValidator,
|
||||
sessionRateLimit,
|
||||
sessionController.createSession
|
||||
)
|
||||
router.post(
|
||||
'/active',
|
||||
activeSessionValidator,
|
||||
sessionController.getOrCreateSession
|
||||
)
|
||||
router.get('/:id', sessionController.getSessionById)
|
||||
router.delete('/:id', sessionController.deleteSessionById)
|
||||
|
||||
|
||||
Reference in new issue
Block a user