- 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>
37 lines
659 B
Python
37 lines
659 B
Python
from pydantic import BaseModel
|
|
from typing import Optional
|
|
|
|
|
|
class LoginRequest(BaseModel):
|
|
email: str
|
|
password: str
|
|
|
|
|
|
class LoginResponse(BaseModel):
|
|
access_token: str
|
|
token_type: str = "bearer"
|
|
user: "UserInfo"
|
|
|
|
|
|
class UserInfo(BaseModel):
|
|
id: str
|
|
email: str
|
|
name: str
|
|
role: Optional[str] = None
|
|
department_id: Optional[str] = None
|
|
is_system_admin: bool = False
|
|
|
|
|
|
class TokenPayload(BaseModel):
|
|
sub: str
|
|
email: str
|
|
role: Optional[str] = None
|
|
department_id: Optional[str] = None
|
|
is_system_admin: bool = False
|
|
exp: int
|
|
iat: int
|
|
|
|
|
|
# Update forward reference
|
|
LoginResponse.model_rebuild()
|