Automated Action fec0fa72e7 Initial project setup with FastAPI, SQLite, and Alembic
- Set up SQLite database configuration and directory structure
- Configure Alembic for proper SQLite migrations
- Add initial model schemas and API endpoints
- Fix OAuth2 authentication
- Implement proper code formatting with Ruff
2025-05-27 20:34:02 +00:00

23 lines
896 B
Python

from sqlalchemy import Boolean, Column, Integer, String, DateTime
from sqlalchemy.orm import relationship
from sqlalchemy.sql import func
from app.db.session import Base
class User(Base):
"""User model for authentication and identification."""
__tablename__ = "users"
id = Column(Integer, primary_key=True, index=True)
email = Column(String, unique=True, index=True, nullable=False)
username = Column(String, unique=True, index=True, nullable=False)
hashed_password = Column(String, nullable=False)
is_active = Column(Boolean, default=True)
is_superuser = Column(Boolean, default=False)
created_at = Column(DateTime(timezone=True), server_default=func.now())
updated_at = Column(DateTime(timezone=True), onupdate=func.now())
# Relationships
locations = relationship("Location", back_populates="user", cascade="all, delete-orphan")