Skip to content

feat(events): add event creation, attendee management, and public event APIs#139

Open
Harxhit wants to merge 4 commits into
Dev-Card:mainfrom
Harxhit:feat/events-api
Open

feat(events): add event creation, attendee management, and public event APIs#139
Harxhit wants to merge 4 commits into
Dev-Card:mainfrom
Harxhit:feat/events-api

Conversation

@Harxhit
Copy link
Copy Markdown
Collaborator

@Harxhit Harxhit commented May 17, 2026

Summary

Implemented the complete Event Mode REST API described in product doc section 5.3. This PR introduces event management support with Prisma models, attendee relationships, authentication and authorization logic, Zod validation, typed API responses, and integration tests for the full event lifecycle.

Closes #30


Type of Change

  • Bug fix
  • New feature
  • Refactor (no functional change)
  • UI / Design change
  • Tests only
  • Documentation
  • Infrastructure / DevOps
  • Security

What Changed

  • Added Event and EventAttendee Prisma models with relational mappings, attendee tracking, and migration files.
  • Implemented event REST API endpoints for create, join, leave, event details, and paginated attendee listing.
  • Added typed response handling for GET endpoints to improve response consistency and type safety.
  • Added Zod validation schemas for request bodies and route params.
  • Added integration tests covering event creation, duplicate joins, attendee listing, and leave flow.
  • Registered event routes in the Fastify application and integrated Prisma event queries with authorization checks.
  • Refactored Prisma structure into src/prisma to align with repository architecture and migration workflow.
  • Left JWT verification logic commented for /api/events/:slug/attendees because the issue description did not explicitly specify whether the endpoint should be public or private. Based on expected production behavior, the route may be better suited as an public endpoint and can be enabled as private easily if maintainers prefer that behavior.

How to Test

  1. Run database migrations:
pnpm --filter @devcard/backend exec prisma migrate dev --config ./src/prisma/prisma.config.ts
  1. Start the backend server:
pnpm --filter @devcard/backend dev
  1. Run tests:
pnpm --filter @devcard/backend test
  1. Verify endpoints:

    • Create an event with authenticated organizer account.
    • Join and leave events with authenticated users.
    • Verify duplicate joins return 409.
    • Verify attendee pagination and public event retrieval.

Checklist

  • My code follows the project's coding style (pnpm -r run lint passes).
  • TypeScript compiles without errors (pnpm -r run typecheck).
  • I have added or updated tests for the changes I made.
  • All tests pass locally (pnpm -r run test).
  • I have updated documentation where necessary.
  • No new console.log or debug statements left in the code.
  • Breaking changes are documented in this PR description.

Proofs

Test

testcase

Schema migration

prisma

Additional Context

This feature was implemented as a greenfield addition to the backend and required designing relational Prisma models, attendee membership handling, role-based authorization, paginated queries, and full integration test coverage for the event workflow.

@Harxhit Harxhit marked this pull request as draft May 17, 2026 18:15
@Harxhit Harxhit added the gssoc:approved Required label for every approved PR. Gives the base +50 points and enables contribution tracking. label May 17, 2026
@Harxhit Harxhit requested a review from ShantKhatri May 17, 2026 18:31
@Harxhit Harxhit marked this pull request as ready for review May 17, 2026 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc:approved Required label for every approved PR. Gives the base +50 points and enables contribution tracking.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

backend: design and implement Event Mode API (/api/events)

1 participant