
- Setup project structure with FastAPI app - Create SQLAlchemy models for categories, questions, quizzes, and results - Implement API endpoints for all CRUD operations - Set up Alembic migrations for database schema management - Add comprehensive documentation in README.md
16 lines
567 B
Python
16 lines
567 B
Python
from sqlalchemy import Column, Integer, String, Text
|
|
from sqlalchemy.orm import relationship
|
|
|
|
from app.db.session import Base
|
|
|
|
|
|
class Category(Base):
|
|
__tablename__ = "categories"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
name = Column(String(100), unique=True, index=True, nullable=False)
|
|
description = Column(Text, nullable=True)
|
|
|
|
# Relationships
|
|
questions = relationship("Question", back_populates="category", cascade="all, delete-orphan")
|
|
quizzes = relationship("Quiz", back_populates="category", cascade="all, delete-orphan") |