fix(backend): 409 Conflict bij het oproepen van /hello met een reeds geregistreerd account.

This commit is contained in:
Gerald Schmittinger 2025-04-29 23:06:58 +02:00
parent 04fd54e3d6
commit 0b9f765366
2 changed files with 6 additions and 34 deletions

View file

@ -1,15 +1,11 @@
import express from 'express';
import { handleGetFrontendAuthConfig, handleHello, postHelloHandler } from '../controllers/auth.js';
import { handleGetFrontendAuthConfig, postHelloHandler } from '../controllers/auth.js';
import { authenticatedOnly, studentsOnly, teachersOnly } from '../middleware/auth/checks/auth-checks.js';
const router = express.Router();
// Returns auth configuration for frontend
router.get('/config', handleGetFrontendAuthConfig);
// This endpoint is called by the client when the user has just logged in.
// It creates or updates the user entity based on the authentication data the endpoint was called with.
router.post('/hello', authenticatedOnly, handleHello);
router.get('/config', handleGetFrontendAuthConfig)
router.get('/testAuthenticatedOnly', authenticatedOnly, (_req, res) => {
/* #swagger.security = [{ "student": [ ] }, { "teacher": [ ] }] */
@ -26,6 +22,8 @@ router.get('/testTeachersOnly', teachersOnly, (_req, res) => {
res.json({ message: 'If you see this, you should be a teacher!' });
});
// This endpoint is called by the client when the user has just logged in.
// It creates or updates the user entity based on the authentication data the endpoint was called with.
router.post('/hello', authenticatedOnly, postHelloHandler);
export default router;