refactor: API-Handler umbenannt zu messages.ts für klare REST-Struktur
- getMessagesAPIHandler.ts in messages.ts umbenannt - API ist nun unter /api/cpl/messages erreichbar - Dateiname entspricht Next.js- und REST-Konventionen
This commit is contained in:
@@ -6,6 +6,6 @@ NEXT_PUBLIC_USE_MOCK_BACKEND_LOOP_START=false
|
||||
NEXT_PUBLIC_EXPORT_STATIC=false
|
||||
NEXT_PUBLIC_USE_CGI=false
|
||||
# App-Versionsnummer
|
||||
NEXT_PUBLIC_APP_VERSION=1.6.545
|
||||
NEXT_PUBLIC_APP_VERSION=1.6.546
|
||||
NEXT_PUBLIC_CPL_MODE=json # json (Entwicklungsumgebung) oder jsSimulatedProd (CPL ->CGI-Interface-Simulator) oder production (CPL-> CGI-Interface Platzhalter)
|
||||
|
||||
|
||||
@@ -5,5 +5,5 @@ NEXT_PUBLIC_CPL_API_PATH=/CPL
|
||||
NEXT_PUBLIC_EXPORT_STATIC=true
|
||||
NEXT_PUBLIC_USE_CGI=true
|
||||
# App-Versionsnummer
|
||||
NEXT_PUBLIC_APP_VERSION=1.6.545
|
||||
NEXT_PUBLIC_APP_VERSION=1.6.546
|
||||
NEXT_PUBLIC_CPL_MODE=production
|
||||
@@ -1,3 +1,12 @@
|
||||
## [1.6.546] – 2025-07-07
|
||||
|
||||
- style: UI-Filterzeile visuell vereinheitlicht – vertikale Ausrichtung und Höhe angepasst
|
||||
|
||||
- 'items-end' durch 'items-center' ersetzt für mittige Ausrichtung der Filterzeile
|
||||
- Button- und Listbox-Komponenten optisch auf gleiche Höhe gebracht
|
||||
- Einheitliches Erscheinungsbild von DatePicker, Anzeigen-Button und Quellen-Dropdown
|
||||
|
||||
---
|
||||
## [1.6.545] – 2025-07-07
|
||||
|
||||
- fix: Listbox-Filter "Alle Quellen" zeigt nun korrekt alle Meldungen an
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "cpl-v4",
|
||||
"version": "1.6.545",
|
||||
"version": "1.6.546",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "cpl-v4",
|
||||
"version": "1.6.545",
|
||||
"version": "1.6.546",
|
||||
"dependencies": {
|
||||
"@fontsource/roboto": "^5.1.0",
|
||||
"@headlessui/react": "^2.2.4",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "cpl-v4",
|
||||
"version": "1.6.545",
|
||||
"version": "1.6.546",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
|
||||
24
pages/api/cpl/messages.ts
Normal file
24
pages/api/cpl/messages.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
// pages/api/cpl/messages.ts
|
||||
import { NextApiRequest, NextApiResponse } from "next";
|
||||
import messagesRaw from "@/mocks/device-cgi-simulator/meldungen/messages.json";
|
||||
|
||||
export default function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
const { fromDate, toDate } = req.query;
|
||||
|
||||
if (!fromDate || !toDate) {
|
||||
return res
|
||||
.status(400)
|
||||
.json({ error: "fromDate und toDate sind erforderlich" });
|
||||
}
|
||||
|
||||
const from = new Date(String(fromDate));
|
||||
const to = new Date(String(toDate));
|
||||
to.setHours(23, 59, 59, 999); // ganzen Tag einschließen
|
||||
|
||||
const filtered = messagesRaw.filter((m) => {
|
||||
const t = new Date(m.t);
|
||||
return t >= from && t <= to;
|
||||
});
|
||||
|
||||
res.status(200).json(filtered);
|
||||
}
|
||||
@@ -16,11 +16,12 @@ export const fetchMessagesService = async (
|
||||
const isDev =
|
||||
typeof window !== "undefined" && window.location.hostname === "localhost";
|
||||
const url = isDev
|
||||
? `/api/cpl/getMessagesAPIHandler`
|
||||
? `/api/cpl/messages?fromDate=${fromDate}&toDate=${toDate}`
|
||||
: `/CPL?Service/ae.ACP&MSS1=${fy};${fm};${fd};${ty};${tm};${td};All`;
|
||||
|
||||
const res = await fetch(url);
|
||||
const raw = await res.json();
|
||||
const response = await fetch(url);
|
||||
const raw = await response.json();
|
||||
const data = Array.isArray(raw) ? raw : raw.data;
|
||||
if (!response.ok) throw new Error("Fehler beim Laden der Meldungen");
|
||||
return data;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user