Merge branch 'dev' into feat/home-data

This commit is contained in:
Gabriellvl 2025-03-02 12:41:24 +01:00 committed by GitHub
commit 1531fa36fe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 931 additions and 35 deletions

View file

@ -1,6 +1,7 @@
import { Request, Response } from 'express';
import { themes } from '../data/themes.js';
import { loadTranslations } from "../util/translationHelper.js";
import { FALLBACK_LANG } from '../config.js';
interface Translations {
curricula_page: {
@ -8,13 +9,9 @@ interface Translations {
};
}
/**
* GET /themes Haalt de lijst met thema's op inclusief vertalingen
*/
export function getThemes(req: Request, res: Response) {
const language = (req.query.language as string)?.toLowerCase() || 'nl';
const translations = loadTranslations<Translations>(language);
const themeList = themes.map((theme) => {
return {
key: theme.title,
@ -28,9 +25,6 @@ export function getThemes(req: Request, res: Response) {
res.json(themeList);
}
/**
* GET /themes/:theme Geeft de HRUIDs terug voor een specifiek thema
*/
export function getThemeByTitle(req: Request, res: Response) {
const themeKey = req.params.theme;
const theme = themes.find((t) => {
@ -40,6 +34,6 @@ export function getThemeByTitle(req: Request, res: Response) {
if (theme) {
res.json(theme.hruids);
} else {
res.status(404).json({ error: 'Thema niet gevonden' });
res.status(404).json({ error: 'Theme not found' });
}
}