diff --git a/endpoints/login.post.py b/endpoints/login.post.py index df5aa08..cc35947 100644 --- a/endpoints/login.post.py +++ b/endpoints/login.post.py @@ -1,25 +1,50 @@ from fastapi import APIRouter, Depends, HTTPException -from core.auth import get_current_user_dummy from core.database import fake_users_db +import uuid +from typing import List, Optional router = APIRouter() -@router.post("/login") -async def login_demo( - username: str = "demo", - password: str = "password" +@router.post("/courses") +async def create_course( + title: str, + description: str, + instructor_id: str, + price: float, + duration_weeks: int, + max_students: Optional[int] = None ): - """Demo login endpoint""" - user = fake_users_db.get(username) - if not user or user["password"] != password: - raise HTTPException(status_code=400, detail="Invalid credentials") + """Create a new course in the online school""" + course_id = str(uuid.uuid4()) + + if not fake_users_db.get(instructor_id): + raise HTTPException(status_code=400, detail="Instructor not found") + + course = { + "id": course_id, + "title": title, + "description": description, + "instructor_id": instructor_id, + "price": price, + "duration_weeks": duration_weeks, + "max_students": max_students, + "enrolled_students": [], + "status": "active" + } + + fake_users_db[course_id] = course return { - "message": "Login successful (demo)", - "user": username, - "token": "dummy_jwt_token_123", + "message": "Course created successfully", + "course_id": course_id, + "course_details": course, "features": { - "rate_limit": 100, - "expires_in": 3600 - } - } + "enrollment_open": True, + "materials_ready": False + }, + "next_steps": [ + "Upload course materials", + "Set up course schedule", + "Invite students" + ] + } \ No newline at end of file