Spaces:
Sleeping
Sleeping
SyedFarooqAlii commited on
Commit ·
bdbdd87
1
Parent(s): 9212eec
all
Browse files- README.md +0 -34
- src/core/config.py +2 -1
- src/core/database.py +4 -11
README.md
DELETED
|
@@ -1,34 +0,0 @@
|
|
| 1 |
-
---
|
| 2 |
-
title: Todo App API
|
| 3 |
-
emoji: ✅
|
| 4 |
-
colorFrom: blue
|
| 5 |
-
colorTo: purple
|
| 6 |
-
sdk: docker
|
| 7 |
-
pinned: false
|
| 8 |
-
---
|
| 9 |
-
|
| 10 |
-
# Secure Todo API
|
| 11 |
-
|
| 12 |
-
A secure multi-user todo web application with JWT authentication built with FastAPI.
|
| 13 |
-
|
| 14 |
-
## Features
|
| 15 |
-
|
| 16 |
-
- JWT-based authentication
|
| 17 |
-
- Multi-user support
|
| 18 |
-
- RESTful API endpoints
|
| 19 |
-
- SQLite database
|
| 20 |
-
- CORS enabled
|
| 21 |
-
|
| 22 |
-
## API Documentation
|
| 23 |
-
|
| 24 |
-
Once deployed, visit `/docs` for the interactive API documentation (Swagger UI).
|
| 25 |
-
|
| 26 |
-
## Endpoints
|
| 27 |
-
|
| 28 |
-
- `GET /` - Root endpoint
|
| 29 |
-
- `GET /health` - Health check
|
| 30 |
-
- `POST /api/v1/auth/login` - User login
|
| 31 |
-
- `POST /api/v1/auth/register` - User registration
|
| 32 |
-
- `GET /api/v1/todos` - Get todos
|
| 33 |
-
- `POST /api/v1/todos` - Create todo
|
| 34 |
-
- And more...
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/core/config.py
CHANGED
|
@@ -53,7 +53,8 @@ class Settings(BaseSettings):
|
|
| 53 |
"http://127.0.0.1:8000",
|
| 54 |
"https://localhost:3000",
|
| 55 |
# Production - Vercel deployments
|
| 56 |
-
"https://multi-tasking-
|
|
|
|
| 57 |
"https://*.vercel.app", # Allow all Vercel preview deployments
|
| 58 |
# Production - Hugging Face
|
| 59 |
"https://syedfarooqali-todo-app.hf.space",
|
|
|
|
| 53 |
"http://127.0.0.1:8000",
|
| 54 |
"https://localhost:3000",
|
| 55 |
# Production - Vercel deployments
|
| 56 |
+
"https://multi-tasking-website-red-stal-ler.vercel.app", # Current deployment
|
| 57 |
+
"https://multi-tasking-todo-app-hot-h-r-rose.vercel.app", # Previous deployment
|
| 58 |
"https://*.vercel.app", # Allow all Vercel preview deployments
|
| 59 |
# Production - Hugging Face
|
| 60 |
"https://syedfarooqali-todo-app.hf.space",
|
src/core/database.py
CHANGED
|
@@ -59,17 +59,10 @@ def get_session() -> Generator[Session, None, None]:
|
|
| 59 |
Get a database session for dependency injection in FastAPI endpoints.
|
| 60 |
Creates a fresh engine and session at runtime to ensure correct database connection.
|
| 61 |
"""
|
| 62 |
-
|
| 63 |
-
# Write to a file to make sure this is being called
|
| 64 |
-
with open('C:/Users/PMLS/Desktop/hackathon2_phase1/PhaseII/backend/debug_log.txt', 'a') as f:
|
| 65 |
-
f.write(f"{datetime.datetime.now()}: get_session() called - creating fresh engine\n")
|
| 66 |
-
print("DEBUG: get_session() called - creating fresh engine") # Debug line
|
| 67 |
engine = get_engine() # Create fresh engine at runtime
|
| 68 |
-
|
| 69 |
-
with open('C:/Users/PMLS/Desktop/hackathon2_phase1/PhaseII/backend/debug_log.txt', 'a') as f:
|
| 70 |
-
f.write(f"{datetime.datetime.now()}: Using engine with URL: {engine.url}\n")
|
| 71 |
-
print(f"DEBUG: Using engine with URL: {engine.url}") # Debug line
|
| 72 |
with Session(engine) as session:
|
| 73 |
-
print(f"DEBUG: Session created with dialect: {session.bind.dialect.name}")
|
| 74 |
-
print(f"DEBUG: Session bound to URL: {str(session.bind.url)}")
|
| 75 |
yield session
|
|
|
|
| 59 |
Get a database session for dependency injection in FastAPI endpoints.
|
| 60 |
Creates a fresh engine and session at runtime to ensure correct database connection.
|
| 61 |
"""
|
| 62 |
+
print("DEBUG: get_session() called - creating fresh engine")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
engine = get_engine() # Create fresh engine at runtime
|
| 64 |
+
print(f"DEBUG: Using engine with URL: {engine.url}")
|
|
|
|
|
|
|
|
|
|
| 65 |
with Session(engine) as session:
|
| 66 |
+
print(f"DEBUG: Session created with dialect: {session.bind.dialect.name}")
|
| 67 |
+
print(f"DEBUG: Session bound to URL: {str(session.bind.url)}")
|
| 68 |
yield session
|