Merge remote-tracking branch 'origin/dev' into feat/user-routes
# Conflicts: # frontend/src/controllers/base-controller.ts # frontend/src/controllers/controllers.ts
This commit is contained in:
		
						commit
						c84964e719
					
				
					 27 changed files with 1644 additions and 177 deletions
				
			
		|  | @ -8,7 +8,7 @@ interface Translations { | |||
|     }; | ||||
| } | ||||
| 
 | ||||
| export function getThemes(req: Request, res: Response) { | ||||
| export function getThemesHandler(req: Request, res: Response) { | ||||
|     const language = (req.query.language as string)?.toLowerCase() || 'nl'; | ||||
|     const translations = loadTranslations<Translations>(language); | ||||
|     const themeList = themes.map((theme) => ({ | ||||
|  | @ -21,8 +21,14 @@ export function getThemes(req: Request, res: Response) { | |||
|     res.json(themeList); | ||||
| } | ||||
| 
 | ||||
| export function getThemeByTitle(req: Request, res: Response) { | ||||
| export function getHruidsByThemeHandler(req: Request, res: Response) { | ||||
|     const themeKey = req.params.theme; | ||||
| 
 | ||||
|     if (!themeKey) { | ||||
|         res.status(400).json({ error: 'Missing required field: theme' }); | ||||
|         return; | ||||
|     } | ||||
| 
 | ||||
|     const theme = themes.find((t) => t.title === themeKey); | ||||
| 
 | ||||
|     if (theme) { | ||||
|  |  | |||
|  | @ -1,14 +1,14 @@ | |||
| import express from 'express'; | ||||
| import { getThemes, getThemeByTitle } from '../controllers/themes.js'; | ||||
| import { getThemesHandler, getHruidsByThemeHandler } from '../controllers/themes.js'; | ||||
| 
 | ||||
| const router = express.Router(); | ||||
| 
 | ||||
| // Query: language
 | ||||
| //  Route to fetch list of {key, title, description, image} themes in their respective language
 | ||||
| router.get('/', getThemes); | ||||
| router.get('/', getThemesHandler); | ||||
| 
 | ||||
| // Arg: theme (key)
 | ||||
| //  Route to fetch list of hruids based on theme
 | ||||
| router.get('/:theme', getThemeByTitle); | ||||
| router.get('/:theme', getHruidsByThemeHandler); | ||||
| 
 | ||||
| export default router; | ||||
|  |  | |||
		Reference in a new issue
	
	 Gabriellvl
						Gabriellvl