localization for ntfy and mail
This commit is contained in:
13
src/db.ts
13
src/db.ts
@@ -4,6 +4,7 @@ import { dirname, resolve } from "node:path";
|
||||
|
||||
import { config } from "./config.js";
|
||||
import { createLogger } from "./logger.js";
|
||||
import { DEFAULT_CATEGORY_NAMES } from "./categoryDefaults.js";
|
||||
|
||||
const logger = createLogger(config.logLevel);
|
||||
|
||||
@@ -52,21 +53,11 @@ CREATE TABLE IF NOT EXISTS categories (
|
||||
`);
|
||||
|
||||
|
||||
const defaultCategories = [
|
||||
"Versicherung",
|
||||
"Strom & Energie",
|
||||
"Internet & Telefon",
|
||||
"Miete & Wohnen",
|
||||
"Mobilfunk",
|
||||
"Streaming & Medien",
|
||||
"Wartung & Service"
|
||||
];
|
||||
|
||||
const categoryRow = db.prepare(`SELECT COUNT(*) as count FROM categories`).get() as { count: number } | undefined;
|
||||
const categoryCount = categoryRow?.count ?? 0;
|
||||
if (categoryCount === 0) {
|
||||
const insertStmt = db.prepare(`INSERT OR IGNORE INTO categories (name) VALUES (?)`);
|
||||
for (const name of defaultCategories) {
|
||||
for (const name of DEFAULT_CATEGORY_NAMES) {
|
||||
insertStmt.run(name);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user