feat: CGI-kompatiblen CSV-Parser für digitale Eingänge implementiert
- digitaleInputsMockData.json angepasst: CGI-nahe Simulation mit CSV-Strings und Stringwerten - fetchDigitalInputsService.ts erweitert: - CSV-Zeilen werden automatisch in Arrays umgewandelt - Labels wie "'DE1','DE2'" werden korrekt aufgeteilt - Daten aus 4 CGI-Blöcken zu 32 Eingängen gemappt - ermöglicht realitätsnahe Tests in Entwicklungsumgebung ohne Produktion
This commit is contained in:
@@ -11,7 +11,7 @@ export default function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
const filePath = path.join(
|
||||
process.cwd(),
|
||||
"mocks",
|
||||
"api",
|
||||
"device-cgi-simulator",
|
||||
"SERVICE",
|
||||
"digitalInputsMockData.json"
|
||||
);
|
||||
@@ -20,16 +20,6 @@ export default function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
return res.status(200).json(json);
|
||||
}
|
||||
|
||||
if (mode === "jsSimulatedProd") {
|
||||
const digitalInputsScript = fs.readFileSync(
|
||||
"mocks/device-cgi-simulator/SERVICE/digitalInputsMockData.js",
|
||||
"utf-8"
|
||||
);
|
||||
res.setHeader("Content-Type", "application/javascript");
|
||||
res.status(200).send(digitalInputsScript);
|
||||
return;
|
||||
}
|
||||
|
||||
return res.status(400).json({ error: "Ungültiger Modus" });
|
||||
} catch (error) {
|
||||
console.error("❌ Fehler beim Parsen der digitalen Eingänge:", error);
|
||||
|
||||
Reference in New Issue
Block a user