Skip to content

API: Implement Board CRUD endpoints #2

Description

@lucianfialho

Problem

Currently the platform has no API endpoints for creating, reading, updating, or deleting Boards. These are foundational CRUD operations needed for the pivot to curated collections.

Solution

Implement RESTful Board management endpoints.

Acceptance Criteria

  • POST /api/boards - Create new board

    • Request body: { title, description?, isPublic? }
    • Response: { id, ownerId, createdAt, ... }
    • Requires authentication
    • Returns 401 if not authenticated
  • GET /api/boards - List user's boards

    • Query params: owned=true|false, limit=20, offset=0
    • Response: { boards: Board[], total: number }
    • Includes owned + collaborated boards
  • GET /api/boards/[id] - Get single board

    • Response: Board with papers array + members array
    • Returns 404 if not found
    • Returns 403 if user is not a member
  • PATCH /api/boards/[id] - Update board

    • Request body: { title?, description?, isPublic? }
    • Requires owner role
    • Returns 403 if not owner
  • DELETE /api/boards/[id] - Delete board

    • Requires owner role
    • Cascades to board_papers and board_members
    • Returns 403 if not owner

Dependencies

Notes

  • All endpoints should validate authentication via auth() helper
  • Use Drizzle ORM for queries
  • Follow existing error handling patterns in the codebase

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions