Selection Plans hotfix

* fixed post/put
* added v2 for get summit by id to remove cache

Change-Id: I864aa863fe32f1417adc424ef2e03349fc0da0b7
This commit is contained in:
Sebastian Marcet 2018-06-12 09:42:47 -07:00
parent 5b649adca1
commit 2116c3f314
4 changed files with 13 additions and 3 deletions

View File

@ -532,7 +532,7 @@ Route::group([
Route::group(['prefix' => 'summits'], function () {
Route::group(['prefix' => '{id}'], function () {
Route::get('', [ 'middleware' => 'auth.user:administrators|summit-front-end-administrators', 'uses' => 'OAuth2SummitApiController@getSummit'])->where('id', 'current|[0-9]+');
// events
Route::group(['prefix' => 'events'], function () {

View File

@ -36,6 +36,8 @@ final class SummitSelectionPlanFactory
*/
public static function populate(SelectionPlan $selection_plan, array $data, Summit $summit){
$selection_plan->setSummit($summit);
if(isset($data['name']))
$selection_plan->setName(trim($data['name']));

View File

@ -81,7 +81,7 @@ final class SummitSelectionPlanService
if(isset($payload['name'])) {
$former_selection_plan = $summit->getSelectionPlanByName($payload['name']);
if ($former_selection_plan->getId() != $selection_plan_id && !is_null($former_selection_plan)) {
if (!is_null($former_selection_plan) && $former_selection_plan->getId() != $selection_plan_id) {
throw new ValidationException(trans(
'validation_errors.SummitSelectionPlanService.updateSelectionPlan.alreadyExistName',
[

View File

@ -91,7 +91,7 @@ class ApiEndpointsSeeder extends Seeder
],
],
[
'name' => 'get-summit',
'name' => 'get-summit-cached',
'route' => '/api/v1/summits/{id}',
'http_method' => 'GET',
'scopes' => [
@ -99,6 +99,14 @@ class ApiEndpointsSeeder extends Seeder
sprintf(SummitScopes::ReadAllSummitData, $current_realm)
],
],
[
'name' => 'get-summit-non-cached',
'route' => '/api/v2/summits/{id}',
'http_method' => 'GET',
'scopes' => [
sprintf(SummitScopes::ReadAllSummitData, $current_realm)
],
],
[
'name' => 'add-summit',
'route' => '/api/v1/summits',