Skip to content

[FEAT]: Implement Comment System API Routes #122

@coxmars

Description

@coxmars

Implement Comment System API Routes

Description

Create API routes for Comment model to enable payout commenting.
Implement full CRUD operations with authentication, payout relationships, and proper error handling.


Requirements

API Routes Structure

  • src/app/api/(comment)/comment/create/route.tsPOST for comment creation
  • src/app/api/(comment)/comment/find-by-payout/[payout_id]/route.tsGET comments for a payout
  • src/app/api/(comment)/comment/update/[id]/route.tsPATCH comment editing
  • src/app/api/(comment)/comment/delete/[id]/route.tsDELETE comment removal

Database Operations

  • Use @/lib/prisma + error handling patterns
  • Optimize with indexes: payout_id, user_id, created_at
  • Include User relation for comment author
  • Return comments ordered chronologically (created_at)

Authorization & Security

  • Users can only update/delete their own comments
  • Validate payout existence before comment creation
  • Follow existing API authentication patterns
  • Proper user context validation

Components

  • src/app/api/(comment)/comment/ directory structure (new)
  • Follow consistent error handling & response patterns

Validations

  • Comments link to existing Payout and User records
  • User can only edit/delete own comments
  • Comments display in chronological order
  • Database queries optimized with proper indexing

⚠️ Follow guidelines for issues, commits, and PRs. Otherwise, they will be ignored.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions