fix: API updateDigitaleEingaenge erweitert – filterzeit, gewichtung, zaehlerAktiv werden jetzt auch gespeichert

This commit is contained in:
ISA
2025-04-24 13:26:16 +02:00
parent 1ca00faca3
commit 560a5cfd76
3 changed files with 15 additions and 5 deletions

View File

@@ -44,7 +44,8 @@ export default async function handler(
}
try {
const { id, name, invertierung } = req.body;
const { id, name, invertierung, filterzeit, gewichtung, zaehlerAktiv } =
req.body;
if (typeof id !== "number" || id < 1 || id > 32) {
return res.status(400).json({ error: "Ungültige ID (132 erlaubt)" });
@@ -55,6 +56,15 @@ export default async function handler(
// Update der Daten
if (typeof name === "string") data.win_de_label[id - 1] = name;
if (typeof invertierung === "number")
data.win_de_invert[id - 1] = invertierung;
if (typeof filterzeit === "number")
data.win_de_time_filter[id - 1] = filterzeit;
if (typeof gewichtung === "number")
data.win_de_weighting[id - 1] = gewichtung;
if (typeof zaehlerAktiv === "number")
data.win_de_counter_active[id - 1] = zaehlerAktiv;
if (typeof invertierung === "number")
data.win_de_invert[id - 1] = invertierung;