diff --git a/endpoints/login.post.py b/endpoints/login.post.py index a8ab4aa..f6912d1 100644 --- a/endpoints/login.post.py +++ b/endpoints/login.post.py @@ -1,37 +1,40 @@ -from fastapi import APIRouter, Depends, HTTPException -from pydantic import BaseModel -from datetime import timedelta -from core.database import get_db -from sqlalchemy.orm import Session -from core.auth import verify_password, create_access_token -from models.user import User +from fastapi import APIRouter, HTTPException +import uuid +from datetime import datetime + +activity_logs = [] # In-memory storage router = APIRouter() -class UserAuth(BaseModel): - username: str - password: str - -@router.post("/login") -async def login( - user_data: UserAuth, - db: Session = Depends(get_db) +@router.post("/login") +async def log_activity( + user_id: str = "demo_user", + action: str = "login", + details: str = "User logged in" ): - """User authentication endpoint""" - user = db.query(User).filter(User.username == user_data.username).first() - - if not user or not verify_password(user_data.password, user.hashed_password): - raise HTTPException(status_code=400, detail="Invalid credentials") - - # Generate token with expiration - access_token = create_access_token( - data={"sub": user.id}, - expires_delta=timedelta(hours=1) - ) - + """Activity logging endpoint""" + if not user_id: + raise HTTPException(status_code=400, detail="User ID is required") + + log_id = str(uuid.uuid4()) + activity_logs.append({ + "id": log_id, + "user_id": user_id, + "action": action, + "details": details, + "timestamp": datetime.now().isoformat(), + "metadata": { + "ip_address": "127.0.0.1", + "user_agent": "demo_agent" + } + }) + return { - "access_token": access_token, - "token_type": "bearer", - "user_id": user.id, - "username": user.username - } + "message": "Activity logged successfully", + "log_id": log_id, + "user_id": user_id, + "features": { + "retention_days": 30, + "analytics_enabled": True + } + } \ No newline at end of file