Commit bab7bba7 authored by Andrea Ruggiero's avatar Andrea Ruggiero
Browse files

Check if user is already booked

parent 2b8c657a
Pipeline #1456 failed with stage
in 1 minute and 12 seconds
......@@ -51,6 +51,9 @@ class EventController extends Controller
if ($event === null) return ApiResponse::error('Evento non trovato');
$user = $sessionRepository->getUserByToken($request->headers->get('X-Auth-Token'));
if ($bookingRepository->getBookingByEventAndUser($user->user_id, $event->event_id) !== null)
return ApiResponse::error('Ti sei già prenotato');
$bookingRepository->addBooking($user->user_id, $event->event_id);
return ApiResponse::success();
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment