Commit 52f6b769 authored by Andrea Ruggiero's avatar Andrea Ruggiero
Browse files

Fix error

parent 9cee92c3
Pipeline #1525 failed with stage
in 0 seconds
......@@ -38,9 +38,12 @@ class EventController extends Controller
"type" => $event->type,
"theme" => $event->theme,
"capacity" => $event->capacity,
"bookings" => count($bookingRepository->getBookingsByEvent($event->event_id)),
"hasBooked" => $bookingRepository->getBookingByEventAndUser($user->user_id, $event->event_id) !== null
"bookings" => count($bookingRepository->getBookingsByEvent($event->event_id))
];
if ($user !== null) {
$response["hasBooked"] = $bookingRepository->getBookingByEventAndUser($user->user_id, $event->event_id) !== null;
}
}
return ApiResponse::success($response);
......@@ -69,24 +72,28 @@ class EventController extends Controller
$user = $sessionRepository->getUserByToken($request->headers->get('X-Auth-Token'));
return ApiResponse::success([ 'event' => [
"id" => $event->event_id,
"title" => $event->title,
"speaker" => $event->speaker,
"date" => $event->date,
"start" => $event->start,
"end" => $event->end,
"place" => $event->place,
"address" => $event->address,
"latitude" => $event->latitude,
"longitude" => $event->longitude,
"capacity" => $event->capacity,
"type" => $event->type,
"theme" => $event->theme,
"bookings" => count($bookingRepository->getBookingsByEvent($event->event_id)),
"hasBooked" => $bookingRepository->getBookingByEventAndUser($user->user_id, $event->event_id) !== null
]
]);
$response = [
"id" => $event->event_id,
"title" => $event->title,
"speaker" => $event->speaker,
"date" => $event->date,
"start" => $event->start,
"end" => $event->end,
"place" => $event->place,
"address" => $event->address,
"latitude" => $event->latitude,
"longitude" => $event->longitude,
"capacity" => $event->capacity,
"type" => $event->type,
"theme" => $event->theme,
"bookings" => count($bookingRepository->getBookingsByEvent($event->event_id))
];
if ($user !== null) {
$response["hasBooked"] = $bookingRepository->getBookingByEventAndUser($user->user_id, $event->event_id) !== null;
}
return ApiResponse::success([ 'event' => $response]);
}
}
\ No newline at end of file
......@@ -113,13 +113,7 @@
"operationId" : "GET_events",
"consumes" : [ "application/json" ],
"produces" : [ "application/json" ],
"parameters" : [ {
"name" : "X-Auth-Token",
"in" : "header",
"description" : "",
"required" : true,
"type" : "string"
} ],
"parameters" : [ ],
"responses" : {
"200" : {
"description" : "",
......@@ -185,13 +179,7 @@
"operationId" : "POST_event",
"consumes" : [ "application/json" ],
"produces" : [ "application/json" ],
"parameters" : [ {
"name" : "X-Auth-Token",
"in" : "header",
"description" : "",
"required" : true,
"type" : "string"
},
"parameters" : [
{
"name" : "id",
"in" : "path",
......@@ -413,13 +401,7 @@
"operationId" : "GET_restaurants",
"consumes" : [ "application/json" ],
"produces" : [ "application/json" ],
"parameters" : [ {
"name" : "X-Auth-Token",
"in" : "header",
"description" : "",
"required" : true,
"type" : "string"
} ],
"parameters" : [ ],
"responses" : {
"200" : {
"description" : "",
......
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