v1.16: SparkReceipt-Schnittstelle - Belege per Webhook importieren und als Kostenposition uebernehmen

This commit is contained in:
2026-10-04 12:43:36 +02:00
parent 189ce10d65
commit 4eab719550
7 changed files with 329 additions and 9 deletions
+19
View File
@@ -164,6 +164,25 @@ BEGIN
ALTER TABLE costs ADD CONSTRAINT costs_building_fkey
FOREIGN KEY (building) REFERENCES buildings(name) ON UPDATE CASCADE;
END $$;
-- Gescannte Belege aus SparkReceipt (Cloud-Archiv), per Webhook importiert.
-- (quelle, externe_id) eindeutig → wiederholte Events aktualisieren statt zu duplizieren.
CREATE TABLE IF NOT EXISTS belege (
id TEXT PRIMARY KEY,
quelle TEXT NOT NULL DEFAULT 'sparkreceipt',
externe_id TEXT NOT NULL,
haendler TEXT NOT NULL DEFAULT '',
betrag NUMERIC(10,2),
waehrung TEXT NOT NULL DEFAULT 'EUR',
datum TEXT NOT NULL DEFAULT '',
jahr INT,
kategorie TEXT NOT NULL DEFAULT '',
notiz TEXT NOT NULL DEFAULT '',
datei_url TEXT NOT NULL DEFAULT '',
zugeordnet BOOLEAN NOT NULL DEFAULT FALSE,
erfasst_am TEXT NOT NULL,
UNIQUE (quelle, externe_id)
);
`
async function init() {