
- Set up FastAPI application with CORS and authentication - Implement user registration and login with JWT tokens - Create SQLAlchemy models for users and items - Add CRUD endpoints for item management - Configure Alembic for database migrations - Add health check endpoint - Include comprehensive API documentation - Set up proper project structure with routers and schemas
15 lines
559 B
Python
15 lines
559 B
Python
from sqlalchemy import Column, Integer, String, Boolean, DateTime
|
|
from sqlalchemy.orm import relationship
|
|
from datetime import datetime
|
|
from app.db.base import Base
|
|
|
|
class User(Base):
|
|
__tablename__ = "users"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
email = Column(String, unique=True, index=True, nullable=False)
|
|
hashed_password = Column(String, nullable=False)
|
|
is_active = Column(Boolean, default=True)
|
|
created_at = Column(DateTime, default=datetime.utcnow)
|
|
|
|
items = relationship("Item", back_populates="owner") |