- Backend (FastAPI): - External API authentication (pj-auth-api.vercel.app) - JWT token validation with Redis session storage - RBAC with department isolation - User, Role, Department models with pjctrl_ prefix - Alembic migrations with project-specific version table - Complete test coverage (13 tests) - Frontend (React + Vite): - AuthContext for state management - Login page with error handling - Protected route component - Dashboard with user info display - OpenSpec: - 7 capability specs defined - add-user-auth change archived 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
26 lines
1.1 KiB
Python
26 lines
1.1 KiB
Python
import uuid
|
|
from sqlalchemy import Column, String, ForeignKey, JSON, Boolean, DateTime, Numeric
|
|
from sqlalchemy.sql import func
|
|
from sqlalchemy.orm import relationship
|
|
from app.core.database import Base
|
|
|
|
|
|
class User(Base):
|
|
__tablename__ = "pjctrl_users"
|
|
|
|
id = Column(String(36), primary_key=True, default=lambda: str(uuid.uuid4()))
|
|
email = Column(String(200), unique=True, nullable=False, index=True)
|
|
name = Column(String(200), nullable=False)
|
|
department_id = Column(String(36), ForeignKey("pjctrl_departments.id"), nullable=True)
|
|
role_id = Column(String(36), ForeignKey("pjctrl_roles.id"), nullable=True)
|
|
skills = Column(JSON, nullable=True)
|
|
capacity = Column(Numeric(5, 2), default=40.00)
|
|
is_active = Column(Boolean, default=True)
|
|
is_system_admin = Column(Boolean, default=False)
|
|
created_at = Column(DateTime, server_default=func.now())
|
|
updated_at = Column(DateTime, server_default=func.now(), onupdate=func.now())
|
|
|
|
# Relationships
|
|
department = relationship("Department", backref="users")
|
|
role = relationship("Role", backref="users")
|