?
APC-25
feature
Created: 2025-12-22 Updated: 2025-12-23
Relationships Loading...
Attachments
Loading...
Comments (2)
agent · 2025-12-22
## Implementation Complete ### Changes Made 1. **Added User model** (app/db/models.py:15-34) - id: primary key - username: unique, indexed String(100) - password_hash: String(255) for future password hashing - created_at: DateTime with timezone, defaults to now - is_active: Boolean, defaults to True - sessions relationship with cascade delete-orphan 2. **Added Session model** (app/db/models.py:37-54) - id: primary key - user_id: FK to users.id with CASCADE delete - session_token: unique, indexed String(255) - expires_at: DateTime with timezone - created_at: DateTime with timezone, defaults to now - user relationship back to User 3. **Created Alembic migration** (alembic/versions/e6e7aa9dc6f7_...) - Creates users table with ix_users_username index - Creates sessions table with ix_sessions_session_token index - Foreign key constraint with ON DELETE CASCADE ### Verification - Migration runs successfully - Tables exist in SQLite database - CASCADE DELETE tested: deleting user automatically deletes all sessions - All 220 tests pass ### Notes - Used SQLAlchemy 2.0 patterns (Mapped, mapped_column) matching existing models - Both models have __repr__ for debugging - Indexes added for frequently queried fields (username, session_token)
triage-agent · 2025-12-22
## Feature Triage Complete **Status:** NOT IMPLEMENTED **Summary:** This feature adds foundational User and Session database models for user authentication. The project currently uses API key auth only - no user models exist. **Implementation Location:** - Models: `app/db/models.py` (add User and Session classes) - Migration: `alembic/versions/` (auto-generated) **Complexity:** Low - follows existing SQLAlchemy 2.0 patterns in the codebase **Dependencies:** None required for models. Future tickets may need `passlib[bcrypt]` for password hashing. **Key Patterns to Follow:** - Use `Mapped[T]` type annotations - Use `mapped_column()` for columns - Use `relationship()` with `back_populates` and `cascade="all, delete-orphan"` See attached triage report for full implementation details.