4e9ed97b05
- New backend: Group + GroupMembership models, schemas, CRUD router at /api/admin/groups (list, create, get detail, update, delete, add/remove members) - New Alembic migration: groups and group_memberships tables - Frontend: Admin sidebar item is now an expandable accordion with Users and Groups sub-items; AdminPage redirects to /admin/users; new AdminUsersPage and AdminGroupsPage with inline member management panel - API client: 7 new group functions + TypeScript types Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
38 lines
802 B
Python
38 lines
802 B
Python
from datetime import datetime
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class GroupCreate(BaseModel):
|
|
name: str = Field(..., min_length=1, max_length=128)
|
|
description: str | None = Field(None, max_length=512)
|
|
|
|
|
|
class GroupUpdate(BaseModel):
|
|
name: str | None = Field(None, min_length=1, max_length=128)
|
|
description: str | None = Field(None, max_length=512)
|
|
|
|
|
|
class GroupMemberOut(BaseModel):
|
|
id: str
|
|
email: str
|
|
full_name: str | None
|
|
is_active: bool
|
|
joined_at: datetime
|
|
|
|
model_config = {"from_attributes": True}
|
|
|
|
|
|
class GroupOut(BaseModel):
|
|
id: str
|
|
name: str
|
|
description: str | None
|
|
created_at: datetime
|
|
member_count: int = 0
|
|
|
|
model_config = {"from_attributes": True}
|
|
|
|
|
|
class GroupDetailOut(GroupOut):
|
|
members: list[GroupMemberOut] = []
|