docs: Update task board and align development plan

This commit is contained in:
2025-11-17 00:23:54 +01:00
parent 264e4c276d
commit 11254095ff
2 changed files with 24 additions and 9 deletions

View File

@@ -9,9 +9,10 @@ The goal is to create a service where streamers can log in using their platform
## 2. Technology Stack
* **Team Communications:** Discord and Nextcloud, primarily. This can change. There's a list of links in the [README.md](README.md)
* **Backend (API & Chat Listeners):** Python (for Twitch/YouTube chat listeners), Node.js (for WebSocket server and potentially other APIs), PHP (for user management and web serving).
* **Database:** MySQL
* **Frontend:** HTML, CSS, JavaScript
* **Backend:** Python 3.9+ (FastAPI)
* **Database:** SQLite (for initial development) with SQLAlchemy ORM
* **Frontend:** Vanilla HTML, CSS, and JavaScript
* **Chat Listeners:** `twitchio` (Twitch), `pytchat` (YouTube)
## 3. Implementation Roadmap

26
auth.py
View File

@@ -79,13 +79,27 @@ async def auth_twitch_callback(code: str, state: str, request: Request, db: Sess
user_response = await client.get(users_url, headers=headers)
user_data = user_response.json()["data"][0]
# TODO: Upsert user into our database
# For now, we'll just return the user data as a proof of concept.
# Encrypt the tokens for storage
encrypted_tokens = security.encrypt_tokens(access_token, refresh_token)
# Here you would create or update the user in your database
# user = db.query(models.User).filter_by(platform_user_id=user_data['id']).first() ... etc.
# --- Database Upsert Logic ---
# Check if the user already exists in our database
user = db.query(models.User).filter(models.User.platform_user_id == user_data['id']).first()
return {"message": "Twitch login successful!", "user": user_data, "encrypted_tokens": encrypted_tokens}
if user:
# If user exists, update their details
user.username = user_data['login']
user.encrypted_tokens = encrypted_tokens
else:
# If user does not exist, create a new record
user = models.User(
platform_user_id=user_data['id'],
username=user_data['login'],
platform="twitch",
encrypted_tokens=encrypted_tokens
)
db.add(user)
db.commit()
return {"message": f"Successfully authenticated as {user_data['display_name']}. User data has been saved."}