The sysadmin panel URL uses site.site_id (UUID string) not site.id (int PK).
All manager account endpoints were querying/expecting the integer PK — none matched.
- GET /by-site/{site_id}: param type str, filter by Site.site_id
- POST /register: site_ids type list[str], query Site.site_id.in_()
- DELETE /site-access: site_id type str, query Site.site_id
- schemas/manager.py: ManagerRegisterRequest.site_ids list[int] → list[str]
- SiteDetailPage.jsx: remove Number() casts on siteId in add/remove calls
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
54 lines
1.0 KiB
Python
54 lines
1.0 KiB
Python
from __future__ import annotations
|
|
from datetime import datetime
|
|
from typing import Optional
|
|
from pydantic import BaseModel
|
|
|
|
|
|
class ManagerRegisterRequest(BaseModel):
|
|
email: str
|
|
password: str
|
|
full_name: Optional[str] = None
|
|
site_ids: list[str] = [] # site_id UUID strings, not integer PKs
|
|
|
|
|
|
class ManagerLoginRequest(BaseModel):
|
|
email: str
|
|
password: str
|
|
|
|
|
|
class ManagerTokenOut(BaseModel):
|
|
access_token: str
|
|
token_type: str = "bearer"
|
|
|
|
|
|
class ManagerSiteOut(BaseModel):
|
|
id: int
|
|
site_id: str
|
|
name: str
|
|
|
|
model_config = {"from_attributes": True}
|
|
|
|
|
|
class ManagerOut(BaseModel):
|
|
id: int
|
|
email: str
|
|
full_name: Optional[str] = None
|
|
is_active: int
|
|
created_at: datetime
|
|
sites: list[ManagerSiteOut] = []
|
|
|
|
model_config = {"from_attributes": True}
|
|
|
|
|
|
class StatsSnapshotOut(BaseModel):
|
|
site_id: int
|
|
snapshot_json: str
|
|
updated_at: datetime
|
|
|
|
model_config = {"from_attributes": True}
|
|
|
|
|
|
class StatsSnapshotRequest(BaseModel):
|
|
site_id: int
|
|
snapshot_json: str
|