Add MariaDB integration and repositories

Introduce DB support and repos: add modules/database.js (connection pool + runDDL) and SQL DDL files (data/ddl/*) for servers, users, providers, identities and credentials. Add repository layers: users, servers, providers, identities, credentials. Update server.js to run DDL at startup. Update .env.example with DB settings and bump dependencies in package.json/package-lock.json (add mariadb, bump dotenv/helmet/path-to-regexp/zod and dev tool upgrades). Error handling and logging included for DDL and repo operations.
This commit is contained in:
2026-08-30 11:03:12 +02:00
parent f1a2850dc8
commit 7a87a98c82
15 changed files with 737 additions and 358 deletions
+4
View File
@@ -9,6 +9,7 @@ const helmet = require("helmet")
const loader = require("./modules/loader")
const DefaultError = require("./errors/DefaultError")
const path2regex = require("path-to-regexp")
const database = require("./modules/database")
const routes = loader.getRecursiveFiles(path.join(__dirname, "routes"))
const schemas = loader.getRecursiveFiles(path.join(__dirname, "schemas"))
@@ -24,6 +25,9 @@ app.use(express.urlencoded({ extended: true }))
app.set("trust proxy", true)
database.runDDL()
.catch(err => logger.error(err))
logger.log("Initializing routes", ["WEB", "yellow"])
for (const schemaFile of schemas) {