refactor(backend): update API routes and service layer

- Update agent router/service/repository with new endpoints
- Update auth routes with phone-based authentication
- Update users service with new phone lookup
- Update schedule_items with new schemas
- Update message schemas with visibility support
- Update settings with new automation scheduler config
- Update CLI with new commands
- Update tests to match new API contracts
This commit is contained in:
qzl
2026-03-19 18:42:59 +08:00
parent 641d847008
commit f0af44d840
36 changed files with 1083 additions and 1853 deletions
+8 -6
View File
@@ -11,21 +11,22 @@ import uvicorn
from app import app
from core.auth.models import CurrentUser
from schemas.user.context import UserContext
from v1.users.dependencies import get_current_user, get_user_service
from v1.users.schemas import UserResponse, UserUpdateRequest
from v1.users.schemas import UserUpdateRequest
class FakeUserService:
"""Fake service for E2E testing."""
def __init__(self, user: UserResponse) -> None:
def __init__(self, user: UserContext) -> None:
self._user = user
async def get_me(self) -> UserResponse:
async def get_me(self) -> UserContext:
return self._user
async def update_me(self, update: UserUpdateRequest) -> UserResponse:
return UserResponse(
async def update_me(self, update: UserUpdateRequest) -> UserContext:
return UserContext(
id=self._user.id,
username=(
update.username if update.username is not None else self._user.username
@@ -38,6 +39,7 @@ class FakeUserService:
bio=update.bio if update.bio is not None else self._user.bio,
)
def _find_free_port() -> int:
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
sock.bind(("127.0.0.1", 0))
@@ -65,7 +67,7 @@ def _start_server(host: str, port: int):
def test_profile_flow_e2e() -> None:
user_id = UUID("00000000-0000-0000-0000-000000000001")
user = UserResponse(
user = UserContext(
id=str(user_id),
username="demo",
avatar_url=None,