This commit is contained in:
Team3
2026-06-05 19:54:34 +02:00
commit 3ed5f7c3e5
18 changed files with 2670 additions and 0 deletions

30
backend/database.py Normal file
View File

@@ -0,0 +1,30 @@
import aiosqlite
from config import DB_PATH
_db: aiosqlite.Connection | None = None
async def get_db() -> aiosqlite.Connection:
global _db
if _db is None:
_db = await aiosqlite.connect(DB_PATH)
return _db
async def init_db():
db = await get_db()
# Tabellen folgen, sobald die ersten Features stehen.
await db.commit()
async def close_db():
global _db
if _db is not None:
await _db.close()
_db = None
def _row_to_dict(row, cursor):
columns = [d[0] for d in cursor.description]
return dict(zip(columns, row))