- 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>
42 lines
866 B
Python
42 lines
866 B
Python
from pydantic import BaseModel
|
|
from typing import Optional, List
|
|
from datetime import datetime
|
|
from decimal import Decimal
|
|
|
|
|
|
class UserBase(BaseModel):
|
|
email: str
|
|
name: str
|
|
department_id: Optional[str] = None
|
|
role_id: Optional[str] = None
|
|
skills: Optional[List[str]] = None
|
|
capacity: Optional[Decimal] = Decimal("40.00")
|
|
|
|
|
|
class UserCreate(UserBase):
|
|
pass
|
|
|
|
|
|
class UserUpdate(BaseModel):
|
|
name: Optional[str] = None
|
|
department_id: Optional[str] = None
|
|
role_id: Optional[str] = None
|
|
skills: Optional[List[str]] = None
|
|
capacity: Optional[Decimal] = None
|
|
is_active: Optional[bool] = None
|
|
|
|
|
|
class UserResponse(UserBase):
|
|
id: str
|
|
is_active: bool
|
|
is_system_admin: bool
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
class UserInDB(UserResponse):
|
|
pass
|