Skip to content

Commit c51279a

Browse files
committed
feat: add new public endpoint for event type
GET api/public/v1/summits/{id}/event-types/{event_type_id} Change-Id: Idf7ecc73ffcec01697b03be30d1f4c64e9fd8f01
1 parent e98b5a1 commit c51279a

4 files changed

Lines changed: 16 additions & 3 deletions

File tree

app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitsEventTypesApiController.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,10 +276,13 @@ public function getEventTypeBySummit($summit_id, $event_type_id)
276276
{
277277
return $this->processRequest(function () use ($summit_id, $event_type_id) {
278278
$summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id);
279-
if (is_null($summit)) return $this->error404();
279+
if (is_null($summit))
280+
return $this->error404();
281+
280282
$event_type = $summit->getEventType(intval($event_type_id));
281283
if (is_null($event_type))
282284
return $this->error404();
285+
283286
return $this->ok(SerializerRegistry::getInstance()->getSerializer($event_type)
284287
->serialize
285288
(

app/ModelSerializers/Summit/SummitEventTypeSerializer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public function serialize($expand = null, array $fields = array(), array $relati
5353
$event_type = $this->object;
5454
if (!$event_type instanceof SummitEventType) return [];
5555
$values = parent::serialize($expand, $fields, $relations, $params);
56+
5657
if(!isset($values['summit_documents'])) {
5758
$summit_documents = [];
5859
if ($event_type->hasSummitDocuments()) {

app/Models/Foundation/Summit/Events/SummitEventType.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,7 @@ public function __construct()
297297
$this->allows_location_timeframe_collision = false;
298298
$this->show_always_on_schedule = false;
299299
$this->summit_documents = new ArrayCollection();
300-
$this->allowed_ticket_types = new ArrayCollection();
301-
300+
$this->allowed_ticket_types = new ArrayCollection();
302301
}
303302

304303
/**

routes/public_api.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@
133133
});
134134

135135
Route::get('', ['middleware' => 'cache:' . Config::get('cache_api_response.get_summit_response_lifetime', 1200), 'uses' => 'OAuth2SummitApiController@getSummit'])->where('id', 'current|[0-9]+');
136+
136137
// members
137138
Route::group(['prefix' => 'members'], function () {
138139
Route::group(['prefix' => 'all'], function () {
@@ -143,6 +144,7 @@
143144
});
144145
});
145146
});
147+
146148
// events
147149
Route::group(['prefix' => 'events'], function () {
148150
Route::group(['prefix' => 'published'], function () {
@@ -161,6 +163,14 @@
161163
});
162164
});
163165
});
166+
167+
168+
// event types
169+
Route::group(['prefix' => 'event-types'], function () {
170+
Route::group(['prefix' => '{event_type_id}'], function () {
171+
Route::get('', 'OAuth2SummitsEventTypesApiController@getEventTypeBySummit');
172+
});
173+
});
164174
// locations
165175
Route::group(['prefix' => 'locations'], function () {
166176
Route::group(['prefix' => '{location_id}'], function () {

0 commit comments

Comments
 (0)