
- Set up project structure with FastAPI, SQLAlchemy, and Alembic - Create database models for User and Item - Implement CRUD operations for all models - Create API endpoints with validation - Add health check endpoint - Configure CORS middleware - Set up database migrations - Add comprehensive documentation in README
18 lines
708 B
Python
18 lines
708 B
Python
from sqlalchemy import Boolean, Column, Integer, String
|
|
from sqlalchemy.sql.sqltypes import DateTime
|
|
from sqlalchemy.sql import func
|
|
from sqlalchemy.orm import relationship
|
|
|
|
from app.database.base_class import Base
|
|
|
|
|
|
class User(Base):
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
email = Column(String, unique=True, index=True, nullable=False)
|
|
hashed_password = Column(String, nullable=False)
|
|
full_name = Column(String, index=True)
|
|
is_active = Column(Boolean, default=True)
|
|
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
|
updated_at = Column(DateTime(timezone=True), onupdate=func.now())
|
|
|
|
items = relationship("Item", back_populates="owner") |