Skip to content

Commit 21f1040

Browse files
Eoicclaude
andcommitted
fix: address code review issues
- Import models in Alembic env.py so autogenerate detects tables - Make ApiResponse.json/jsonList nullable for 204 No Content responses - Add reaction_type path param to remove_reaction endpoint Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent d048224 commit 21f1040

4 files changed

Lines changed: 10 additions & 7 deletions

File tree

client/lib/services/api_client.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,9 @@ class ApiResponse {
108108

109109
bool get isSuccess => statusCode >= 200 && statusCode < 300;
110110

111-
Map<String, dynamic> get json => jsonDecode(body) as Map<String, dynamic>;
111+
Map<String, dynamic>? get json =>
112+
body.isNotEmpty ? jsonDecode(body) as Map<String, dynamic> : null;
112113

113-
List<dynamic> get jsonList => jsonDecode(body) as List<dynamic>;
114+
List<dynamic>? get jsonList =>
115+
body.isNotEmpty ? jsonDecode(body) as List<dynamic> : null;
114116
}

server/alembic/env.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import asyncio
22
from logging.config import fileConfig
33

4-
from alembic import context
54
from sqlalchemy import pool
65
from sqlalchemy.ext.asyncio import async_engine_from_config
76

7+
import papyrus.models # noqa: F401 — register models with Base.metadata
8+
from alembic import context
89
from papyrus.config import get_settings
910
from papyrus.core.database import Base
1011

server/src/papyrus/api/routes/reviews.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ async def react_to_review(
7777
return Response(status_code=status.HTTP_204_NO_CONTENT)
7878

7979

80-
@router.delete("/{review_id}/react", status_code=status.HTTP_204_NO_CONTENT)
81-
async def remove_reaction(user_id: CurrentUserId, review_id: UUID) -> Response:
82-
"""Remove a reaction from a review."""
80+
@router.delete("/{review_id}/react/{reaction_type}", status_code=status.HTTP_204_NO_CONTENT)
81+
async def remove_reaction(user_id: CurrentUserId, review_id: UUID, reaction_type: str) -> Response:
82+
"""Remove a specific reaction from a review."""
8383
return Response(status_code=status.HTTP_204_NO_CONTENT)

server/tests/test_reviews.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def test_react_to_review(client: TestClient, auth_headers: dict[str, str]):
5858

5959
def test_remove_reaction(client: TestClient, auth_headers: dict[str, str]):
6060
review_id = str(uuid4())
61-
response = client.delete(f"/v1/reviews/{review_id}/react", headers=auth_headers)
61+
response = client.delete(f"/v1/reviews/{review_id}/react/like", headers=auth_headers)
6262
assert response.status_code == 204
6363

6464

0 commit comments

Comments
 (0)