Skip to content

feat: add validation to ensure event registrations do not exceed capa…#166

Open
mug1sha wants to merge 3 commits into
Open-Source-Kigali:devfrom
mug1sha:fix/event-capacity-validation
Open

feat: add validation to ensure event registrations do not exceed capa…#166
mug1sha wants to merge 3 commits into
Open-Source-Kigali:devfrom
mug1sha:fix/event-capacity-validation

Conversation

@mug1sha
Copy link
Copy Markdown
Contributor

@mug1sha mug1sha commented May 21, 2026

##What does this PR do?

This PR implements validation guards for event creation and updates to ensure that the registered count does not exceed the event's capacity. It handles both new input data and
cross-field checks against existing database values during partial updates to maintain business logic integrity.

##Related issue

Closes #28

##How did you test it?

  • Unit Tests: Created src/controllers/event.controller.test.ts with test cases verifying that exceeding capacity returns a 400 Bad Request in both POST /api/events and PUT
    /api/events/:id scenarios.
  • Integration: Verified that the entire test suite passes (npm test), confirming no regressions in existing event functionality.
  • Quality Checks: Confirmed the code follows project standards by running npm run lint and npm run format.

##Checklist

  • My code builds (npm run build)
  • I added or updated tests and npm test passes
  • I updated docs/openapi.yaml if I changed any routes
  • I added a Prisma migration if I changed schema.prisma
  • I updated docs or .env.example if needed (Updated README.md with capacity validation details)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

registered count on events can exceed capacity without validation

1 participant