[#185] DB schema: title column on plots + comments table + API#225
[#185] DB schema: title column on plots + comments table + API#225realproject7 merged 2 commits intomainfrom
Conversation
Migration: - ALTER TABLE plots ADD COLUMN title TEXT DEFAULT '' - CREATE TABLE comments (storyline_id, plot_index, commenter_address, content, created_at, hidden) with indexes and RLS Types: - Added title field to Plot type (Row/Insert/Update) - Added Comment type with full Row/Insert/Update definitions Plot indexer: - Extracts title from PlotChained event args and stores it Comments API: - GET /api/comments?storylineId=N&plotIndex=M — paginated, 20 per page - POST /api/comments — wallet signature auth, 1 comment per address per plot per minute rate limit, max 1000 chars Fixes #185 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
project7-interns
left a comment
There was a problem hiding this comment.
Verdict: REQUEST CHANGES
Summary
The schema and indexer pieces look aligned with #185, but the new comments read API does not match the API contract defined in the issue. That makes the foundation inconsistent for the blocked Phase 9 comment UI work.
Findings
- [high]
GET /api/commentsimplements the wrong pagination contract- File:
src/app/api/comments/route.ts:14 - File:
src/app/api/comments/route.ts:30 - Suggestion: implement the issue-specified
pageandlimitquery params, or at minimum accept them compatibly and derive the Supabase range from those values. Right now the route only acceptsoffsetand hardcodesPAGE_SIZE = 20, but issue #185 explicitly definesGET /api/comments?storylineId=X&plotIndex=Y&page=1&limit=20.
- File:
Decision
Requesting changes because #185 is the schema/API foundation for later comment UI work, and the shipped API contract should match the issue rather than introducing a different pagination shape.
project7-interns
left a comment
There was a problem hiding this comment.
Verdict: APPROVE
Summary
The follow-up change fixes the API contract mismatch by implementing page and limit query params on GET /api/comments, which aligns the route with issue #185. The schema, types, plot-title indexing, and comments API foundation now look consistent for the blocked Phase 9 frontend work.
Findings
- None.
Decision
Approving because the previously blocking pagination contract gap is resolved, and GitHub lint-and-typecheck passes on the updated head.
project7-interns
left a comment
There was a problem hiding this comment.
T2b: APPROVE
Well-structured schema + API foundation for Phase 9:
- Migration:
titleon plots,commentstable with proper indexes, RLS filtering hidden rows - Plot indexer: Correctly extracts
titlefrom updatedPlotChainedevent - Comments GET:
page/limitpagination with total count — matches issue #185 spec - Comments POST: Strong auth — wallet signature binds to specific comment content (prevents replay), 1/min rate limit per address per plot, 1000 char max
- Types: Supabase types and
Commentexport updated consistently
Minor nit: GET route code comment (line 16) still references offset=0 but code uses page/limit. Cosmetic only.
Summary
title TEXT DEFAULT ''on plots table;commentstable with indexes on(storyline_id, plot_index)and(commenter_address), RLS for public readtitleto Plot type, addedCommenttype aliastitlefrom updated PlotChained event and stores itGET /api/comments?storylineId=N&plotIndex=M(paginated, 20/page) +POST /api/comments(wallet signature auth, 1 comment per address per plot per minute, max 1000 chars)Test plan
Fixes #185
🤖 Generated with Claude Code