Description
addEvent in src/controllers/event.controller.ts calls buildEventData and then immediately passes the result to the service. If required fields like title, description, location, or date are missing from the request body, Prisma throws a validation error which surfaces as a 500.
Fix
Add explicit checks for required fields before calling the service:
const required = ['title', 'description', 'category', 'location', 'date']
for (const field of required) {
if (!req.body[field]) return response.failure(res, `${field} is required`, 400)
}
Description
addEventinsrc/controllers/event.controller.tscallsbuildEventDataand then immediately passes the result to the service. If required fields liketitle,description,location, ordateare missing from the request body, Prisma throws a validation error which surfaces as a 500.Fix
Add explicit checks for required fields before calling the service: