feat(sf-b2): GET /users/me/recent-parcels — stub endpoint (auth TODO) #329

Merged
lekss361 merged 1 commit from feat/sf-b2-recent-stub into main 2026-05-17 21:04:17 +00:00
Owner

Summary

SF Wave 1 / Group B / sub-task B2 из SiteFinder Backend Migration Plan May17. Stub endpoint для recent parcels — real impl после NextAuth (Wave 3).

Files

  • backend/app/api/v1/users.py — NEW router с GET /users/me/recent-parcels stub
  • backend/app/main.pyapp.include_router(users.router, prefix="/api/v1", tags=["users"])

Response shape

{"items": [], "total": 0, "stub": true, "real_impl_after": "NextAuth"}

Validation: ?limit ∈ [1, 50], иначе HTTP 422.

Part of plan

Vault code/patterns/SiteFinder_Backend_Migration_Plan_May17.md §B2. Real implementation будет читать parcel_analysis_history table после NextAuth wired.

## Summary SF Wave 1 / Group B / sub-task **B2** из SiteFinder Backend Migration Plan May17. Stub endpoint для recent parcels — real impl после NextAuth (Wave 3). ## Files - `backend/app/api/v1/users.py` — NEW router с `GET /users/me/recent-parcels` stub - `backend/app/main.py` — `app.include_router(users.router, prefix="/api/v1", tags=["users"])` ## Response shape ```json {"items": [], "total": 0, "stub": true, "real_impl_after": "NextAuth"} ``` Validation: `?limit` ∈ [1, 50], иначе HTTP 422. ## Part of plan Vault `code/patterns/SiteFinder_Backend_Migration_Plan_May17.md` §B2. Real implementation будет читать `parcel_analysis_history` table после NextAuth wired.
lekss361 added 1 commit 2026-05-17 21:02:08 +00:00
Author
Owner

Deep Code Review — verdict APPROVE

Summary

  • Status: APPROVE
  • Files: 2 (P1: backend/app/api/v1/users.py NEW, backend/app/main.py MODIFIED)
  • Lines: +32 / -0

Checks

  • FastAPI router pattern matches existing backend/app/api/v1/*.py style (module-level router = APIRouter(), logger = logging.getLogger(__name__))
  • Annotated[int, Query(ge=1, le=50)] = 10 — корректная Pydantic v2 validation, HTTP 422 для out-of-range
  • Path /users/me/recent-parcels под prefix="/api/v1" = /api/v1/users/me/recent-parcels. Grep по backend/ — collisions нет (никаких других /users или me/recent-parcels маршрутов не существует). Префиксы остальных routers (/api/v1/parcels, /api/v1/concepts, etc.) не пересекаются.
  • No import psycopg2, no print(), no requests — backend conventions OK
  • from __future__ import annotations + type hints present
  • Stub returns empty list для всех — security concern нет: data leak невозможен (response shape константная, no DB read, no PII)
  • stub: true, real_impl_after: "NextAuth" — явный маркер для frontend, не спутают с пустым реальным результатом

Cross-file impact

  • New route добавит entry в frontend/openapi.json после next codegen — non-blocking follow-up
  • Real impl (Wave 3) добавит auth dependency + чтение parcel_analysis_history — response shape items[] уже совпадает с предполагаемой контрактной формой

Nits (не блокирующее, не требует fix)

  • Response type hint -> dict можно сделать строгим Pydantic-моделью когда придёт real impl (сейчас OK для stub)
  • tags=["users"] в include_router — единственный с этим тегом, нормально для нового домена

Verdict rationale

Минимальный, корректный stub. Pattern consistent с trade_in.py (тоже mock с TODO для real impl). Низкий blast radius — новый изолированный endpoint, ничего не ломает.

Merging.

## Deep Code Review — verdict APPROVE ### Summary - **Status**: APPROVE - **Files**: 2 (P1: `backend/app/api/v1/users.py` NEW, `backend/app/main.py` MODIFIED) - **Lines**: +32 / -0 ### Checks - FastAPI router pattern matches existing `backend/app/api/v1/*.py` style (module-level `router = APIRouter()`, `logger = logging.getLogger(__name__)`) - `Annotated[int, Query(ge=1, le=50)] = 10` — корректная Pydantic v2 validation, HTTP 422 для out-of-range - Path `/users/me/recent-parcels` под `prefix="/api/v1"` = `/api/v1/users/me/recent-parcels`. Grep по `backend/` — collisions нет (никаких других `/users` или `me/recent-parcels` маршрутов не существует). Префиксы остальных routers (`/api/v1/parcels`, `/api/v1/concepts`, etc.) не пересекаются. - No `import psycopg2`, no `print()`, no `requests` — backend conventions OK - `from __future__ import annotations` + type hints present - Stub returns empty list для всех — security concern нет: data leak невозможен (response shape константная, no DB read, no PII) - `stub: true, real_impl_after: "NextAuth"` — явный маркер для frontend, не спутают с пустым реальным результатом ### Cross-file impact - New route добавит entry в `frontend/openapi.json` после next codegen — non-blocking follow-up - Real impl (Wave 3) добавит auth dependency + чтение `parcel_analysis_history` — response shape `items[]` уже совпадает с предполагаемой контрактной формой ### Nits (не блокирующее, не требует fix) - Response type hint `-> dict` можно сделать строгим Pydantic-моделью когда придёт real impl (сейчас OK для stub) - `tags=["users"]` в `include_router` — единственный с этим тегом, нормально для нового домена ### Verdict rationale Минимальный, корректный stub. Pattern consistent с `trade_in.py` (тоже mock с TODO для real impl). Низкий blast radius — новый изолированный endpoint, ничего не ломает. Merging.
lekss361 merged commit 8673290009 into main 2026-05-17 21:04:17 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lekss361/gendesign#329
No description provided.