Змінено директорії

Додано скрипти CRON
Поліпшено механізм запису стендів та їх редагування
This commit is contained in:
2025-10-27 00:11:18 +02:00
parent 1d9f9a1468
commit 04f39da611
196 changed files with 4962 additions and 4065 deletions

View File

@@ -1,11 +1,8 @@
const sqlite3 = require("sqlite3");
const path = require("path");
require("dotenv").config();
const dbPath = process.env.DATABASE_PATH || path.join(__dirname, ".."); // если в .env относительный путь
const fileName = process.env.DATABASE_FILE || "database.sqlite";
const fullPath = path.isAbsolute(dbPath) ? path.join(dbPath, fileName) : path.join(dbPath, fileName);
const dbPath = process.env.DATABASE_PATH || path.join(__dirname, "..");
const fullPath = path.join(dbPath, "database.sqlite");
const db = new sqlite3.Database(fullPath, (err) => {
if (err) {
@@ -15,7 +12,6 @@ const db = new sqlite3.Database(fullPath, (err) => {
}
});
// optional: enable foreign keys
db.exec("PRAGMA foreign_keys = ON;");
module.exports = db;