This commit is contained in:
2025-03-31 00:22:21 +03:00
commit 38f2a05107
146 changed files with 66771 additions and 0 deletions

34
api/config/db.js Normal file
View File

@@ -0,0 +1,34 @@
const sqlite3 = require("sqlite3").verbose();
const path = require('path');
const dbPath = process.env.DATABASE_PATH || '../';
const db = new sqlite3.Database(path.join(dbPath, 'database.sqlite'));
// db.serialize(() => {
// db.run(`
// CREATE TABLE IF NOT EXISTS sheeps (
// id INTEGER PRIMARY KEY AUTOINCREMENT,
// uuid TEXT UNIQUE
// )
// `);
// db.run(`
// CREATE TABLE IF NOT EXISTS administrators (
// sheep_id INTEGER PRIMARY KEY,
// can_view_sheeps INTEGER DEFAULT 0,
// FOREIGN KEY (sheep_id) REFERENCES sheeps(id)
// )
// `);
// db.run(`
// CREATE TABLE IF NOT EXISTS sessions (
// session_id TEXT PRIMARY KEY,
// sheep_id INTEGER,
// role TEXT DEFAULT 'sheep',
// expires_at INTEGER,
// FOREIGN KEY (sheep_id) REFERENCES sheeps(id)
// )
// `);
// });
module.exports = db;