Initial commit.

This commit is contained in:
g_it 2026-03-31 11:43:01 +02:00
commit 2fa935016e
Signed by untrusted user who does not match committer: g_it
GPG key ID: A2B0A7C06A054627
11 changed files with 1410 additions and 0 deletions

17
app/database.py Normal file
View file

@ -0,0 +1,17 @@
import sqlite3
from pathlib import Path
DATABASE_PATH = Path(__file__).parent.parent / "data" / "reviews.db"
def get_db():
"""
FastAPI dependency that provides a database connection.
Yields a connection, then closes it when the request is done.
"""
conn = sqlite3.connect(DATABASE_PATH)
conn.row_factory = sqlite3.Row
try:
yield conn
finally:
conn.close()