Skip to content

✅ Phase 2: REST API Routes - Trip, Heritage & Booking APIs #1376

@kurosh87

Description

@kurosh87

Completed

14 REST API Endpoints Created:

Trip Management APIs

  • /app/api/trips/route.ts - GET (list), POST (create)
  • /app/api/trips/[id]/route.ts - GET, PATCH, DELETE
  • /app/api/trips/[id]/days/route.ts - GET, POST
  • /app/api/trips/[id]/days/[dayId]/route.ts - GET, PATCH, DELETE
  • /app/api/trips/[id]/items/route.ts - GET, POST
  • /app/api/trips/[id]/items/[itemId]/route.ts - PATCH, DELETE
  • /app/api/trips/[id]/items/reorder/route.ts - POST (drag-and-drop)

Heritage APIs

  • /app/api/sites/route.ts - GET with search filters
  • /app/api/sites/[slug]/route.ts - GET site details with POIs
  • /app/api/circuits/route.ts - GET with filters
  • /app/api/circuits/[id]/route.ts - GET circuit with stops

Booking APIs

  • /app/api/trips/[id]/bookings/route.ts - GET, POST
  • /app/api/trips/[id]/bookings/[bookingId]/route.ts - GET, PATCH, DELETE

Features:

  • ✅ Authentication checks on all routes
  • ✅ Role-based access control (owner/editor/contributor/viewer)
  • ✅ Proper error handling and HTTP status codes
  • ✅ Support for public/shared/private visibility
  • ✅ Granular collaborator permissions
  • ✅ Type-safe request/response handling

Security:

  • Session validation
  • Permission checking before mutations
  • Cascading delete protection
  • Input validation

References:

  • FUNCTIONALITY_SPEC.md sections 1, 2
  • All endpoints follow REST best practices

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions