Skip to content

Commit 7defe19

Browse files
committed
chore: release v1.5.2
1 parent efc2691 commit 7defe19

7 files changed

Lines changed: 243 additions & 102 deletions

File tree

packages/backend/src/routes/dso.routes.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,28 @@ const getEnv = (req: Request): 'pre' | 'prod' => {
1111
return req.headers['x-dso-env'] === 'prod' ? 'prod' : 'pre';
1212
};
1313

14+
/**
15+
* POST /v1/dso/activiteiten/oin
16+
* Retrieve all activities registered by a specific authority (OIN).
17+
*
18+
* Body: { oin: string }
19+
*/
20+
router.post('/activiteiten/oin', async (req: Request, res: Response) => {
21+
res.set('API-Version', packageJson.version);
22+
try {
23+
const { oin, datumVanaf } = req.body as { oin?: string; datumVanaf?: string };
24+
if (!oin) {
25+
return res.status(400).json({ success: false, error: 'oin is required' });
26+
}
27+
const data = await dsoService.getActiviteitenByOin(oin, getEnv(req), datumVanaf);
28+
res.status(200).json({ success: true, data });
29+
} catch (error) {
30+
const msg = error instanceof Error ? error.message : 'DSO request failed';
31+
logger.error('[DSO Routes] POST /activiteiten/oin failed', { error: msg });
32+
res.status(502).json({ success: false, error: msg });
33+
}
34+
});
35+
1436
/**
1537
* POST /v1/dso/activiteiten/zoek
1638
* Search activities by date and optional point geometry.

packages/backend/src/services/dso.service.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,41 @@ export interface ZoekOptions {
8585
pageSize?: number;
8686
}
8787

88+
export async function getActiviteitenByOin(oin: string, env: DsoEnv = 'pre', datumVanaf?: string): Promise<unknown> {
89+
const url = `${getDsoConfig(env).rtrBaseUrl}/activiteiten/_wijzigingen`;
90+
91+
// Default to yesterday if no date provided — today returns empty due to DSO timing
92+
if (!datumVanaf) {
93+
const d = new Date();
94+
d.setDate(d.getDate() - 1);
95+
datumVanaf = `${String(d.getDate()).padStart(2, '0')}-${String(d.getMonth() + 1).padStart(2, '0')}-${d.getFullYear()}`;
96+
}
97+
98+
logger.info('[DSO] POST activiteiten/_wijzigingen', { env, oin, datumVanaf });
99+
100+
const controller = new AbortController();
101+
const timeoutId = setTimeout(() => controller.abort(), config.dso.timeout);
102+
try {
103+
const response = await fetch(url, {
104+
method: 'POST',
105+
headers: {
106+
'x-api-key': getDsoConfig(env).apiKey,
107+
'Content-Type': 'application/json',
108+
Accept: 'application/hal+json',
109+
},
110+
body: JSON.stringify({ oin, datumVanaf }),
111+
signal: controller.signal,
112+
});
113+
if (!response.ok) {
114+
const text = await response.text();
115+
throw new Error(`DSO responded ${response.status}: ${text}`);
116+
}
117+
return response.json();
118+
} finally {
119+
clearTimeout(timeoutId);
120+
}
121+
}
122+
88123
export async function zoekActiviteiten(opts: ZoekOptions = {}, env: DsoEnv = 'pre'): Promise<unknown> {
89124
const d = new Date();
90125
const today = `${String(d.getDate()).padStart(2, '0')}-${String(d.getMonth() + 1).padStart(2, '0')}-${d.getFullYear()}`;

packages/frontend/src/App.tsx

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -565,39 +565,6 @@ const App: React.FC = () => {
565565

566566
<hr className="border-slate-100" />
567567

568-
<div>
569-
<label className="block text-xs font-medium text-slate-500 mb-2 uppercase tracking-wider">
570-
DSO Environment
571-
</label>
572-
<div className="flex gap-2">
573-
<button
574-
onClick={() => setDsoEnv('pre')}
575-
className={`flex-1 py-2 text-xs font-medium rounded-lg border transition-colors ${
576-
dsoEnv === 'pre'
577-
? 'bg-amber-100 text-amber-800 border-amber-300'
578-
: 'bg-white text-slate-600 border-slate-300 hover:border-slate-400'
579-
}`}
580-
>
581-
Pre-production
582-
</button>
583-
<button
584-
onClick={() => setDsoEnv('prod')}
585-
className={`flex-1 py-2 text-xs font-medium rounded-lg border transition-colors ${
586-
dsoEnv === 'prod'
587-
? 'bg-green-100 text-green-800 border-green-300'
588-
: 'bg-white text-slate-600 border-slate-300 hover:border-slate-400'
589-
}`}
590-
>
591-
Production
592-
</button>
593-
</div>
594-
<p className="text-[10px] text-slate-400 mt-1">
595-
Independent of the LDE environment. Persisted across sessions.
596-
</p>
597-
</div>
598-
599-
<hr className="border-slate-100" />
600-
601568
<div>
602569
<div className="flex justify-between items-center mb-2">
603570
<label className="text-xs font-medium text-slate-500 uppercase tracking-wider">
@@ -678,6 +645,39 @@ const App: React.FC = () => {
678645
</div>
679646
</div>
680647
</div>
648+
649+
<hr className="border-slate-100" />
650+
651+
<div>
652+
<label className="block text-xs font-medium text-slate-500 mb-2 uppercase tracking-wider">
653+
DSO Environment
654+
</label>
655+
<div className="flex gap-2">
656+
<button
657+
onClick={() => setDsoEnv('pre')}
658+
className={`flex-1 py-2 text-xs font-medium rounded-lg border transition-colors ${
659+
dsoEnv === 'pre'
660+
? 'bg-amber-100 text-amber-800 border-amber-300'
661+
: 'bg-white text-slate-600 border-slate-300 hover:border-slate-400'
662+
}`}
663+
>
664+
Pre-production
665+
</button>
666+
<button
667+
onClick={() => setDsoEnv('prod')}
668+
className={`flex-1 py-2 text-xs font-medium rounded-lg border transition-colors ${
669+
dsoEnv === 'prod'
670+
? 'bg-green-100 text-green-800 border-green-300'
671+
: 'bg-white text-slate-600 border-slate-300 hover:border-slate-400'
672+
}`}
673+
>
674+
Production
675+
</button>
676+
</div>
677+
<p className="text-[10px] text-slate-400 mt-1">
678+
Independent of the LDE environment. Persisted across sessions.
679+
</p>
680+
</div>
681681
</div>
682682
</div>
683683
)}

packages/frontend/src/changelog.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,45 @@
11
{
22
"versions": [
3+
{
4+
"version": "1.5.2",
5+
"date": "April 2026",
6+
"status": "Released",
7+
"statusColor": "green",
8+
"borderColor": "green",
9+
"sections": [
10+
{
11+
"icon": "",
12+
"title": "DSO Explorer — improvements",
13+
"iconColor": "blue",
14+
"items": [
15+
"DSO environment selector added to the Settings panel (gear icon): switch between pre-production and production DSO independently of the LDE environment, persisted across sessions in localStorage",
16+
"Environment badge in the DSO Explorer header updates to reflect the active DSO environment (amber for pre-production, green for production)",
17+
"Both DSO environments (pre-production and production) use separate API keys configured via DSO_API_KEY and DSO_API_KEY_PROD environment variables",
18+
"Location presets (Lelystad, Flevoland) now filter by authority OIN via POST /activiteiten/_wijzigingen instead of geometry — shows only that authority's registered activities rather than all activities geographically intersecting the area",
19+
"datumVanaf flows from the Valid on date field through to the _wijzigingen call — changing the date while a preset is active and pressing Load reloads that authority's list for the new date",
20+
"Pressing Load while a preset is active reloads the authority list for the selected date instead of deselecting the preset and reverting to the default list",
21+
"Clear button added next to active preset label to explicitly reset to the default list",
22+
"Yesterday used as the default datumVanaf for authority presets",
23+
"Child activities in the detail panel now show human-readable names fetched in parallel after the parent detail loads",
24+
"Graceful 404 handling in the detail panel: activities not available in the active DSO environment show a clear message instead of a raw error",
25+
"Pagination unified to 20 items per page across both Concepts and Activities tabs"
26+
]
27+
},
28+
{
29+
"icon": "⚙️",
30+
"title": "Backend — DSO service",
31+
"iconColor": "gray",
32+
"items": [
33+
"POST /v1/dso/activiteiten/oin — new endpoint wrapping _wijzigingen, accepts oin and optional datumVanaf, defaults to yesterday",
34+
"X-Dso-Env request header added to all DSO frontend calls; backend reads it to select pre-production or production DSO config",
35+
"X-Dso-Env added to CORS allowedHeaders to resolve preflight errors",
36+
"dsoProd config block in config.ts: DSO_CATALOGUE_BASE_URL_PROD, DSO_RTR_BASE_URL_PROD, DSO_API_KEY_PROD environment variables",
37+
"getDsoConfig() helper selects the correct base URL and API key per request",
38+
"env parameter threaded through all dso.service.ts exported functions and logged with each DSO request"
39+
]
40+
}
41+
]
42+
},
343
{
444
"version": "1.5.1",
545
"date": "April 2026",

0 commit comments

Comments
 (0)