Added get my speaker profile per summit
GET /api/v1/summits/{id}/speakers/me expand presentations,member scopes %s/speakers/read/me %s/summits/read/all Change-Id: I59ae28ce2966a50d9754c76005ff6dd810403aee
This commit is contained in:
parent
08098c2157
commit
2fcc05e7a4
@ -14,7 +14,6 @@
|
||||
use App\Services\Model\IAttendeeService;
|
||||
use Illuminate\Console\Command;
|
||||
use models\summit\ISummitRepository;
|
||||
|
||||
/**
|
||||
* Class PromoCodesRedeemProcessor
|
||||
* @package App\Console\Commands
|
||||
@ -80,7 +79,7 @@ final class PromoCodesRedeemProcessor extends Command
|
||||
$summit_id = $this->argument('summit_id');
|
||||
|
||||
if(is_null($summit_id))// if we dont provide a summit id, then get current
|
||||
$summit = $this->repository->getCurrent();
|
||||
$summit = $this->repository->getCurrentAndAvailable();
|
||||
else
|
||||
$summit = $this->repository->getById(intval($summit_id));
|
||||
$this->info(sprintf("starting to process promo codes for summit id %s", $summit->getIdentifier()));
|
||||
|
@ -90,7 +90,7 @@ final class SummitJsonGenerator extends Command {
|
||||
$summit_id = $this->argument('summit_id');
|
||||
|
||||
if(is_null($summit_id))// if we dont provide a summit id, then get current
|
||||
$summit = $this->repository->getCurrent();
|
||||
$summit = $this->repository->getCurrentAndAvailable();
|
||||
else
|
||||
$summit = $this->repository->getById(intval($summit_id));
|
||||
|
||||
|
@ -314,6 +314,47 @@ final class OAuth2SummitSpeakersApiController extends OAuth2ProtectedController
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $summit_id
|
||||
* @return mixed
|
||||
*/
|
||||
public function getMySummitSpeaker($summit_id){
|
||||
try {
|
||||
$summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id);
|
||||
if (is_null($summit)) return $this->error404();
|
||||
|
||||
$speaker = CheckSpeakerStrategyFactory::build(CheckSpeakerStrategyFactory::Me, $this->resource_server_context)->check('me', $summit);
|
||||
if (is_null($speaker)) return $this->error404();
|
||||
|
||||
$serializer_type = $this->serializer_type_selector->getSerializerType();
|
||||
|
||||
return $this->ok
|
||||
(
|
||||
SerializerRegistry::getInstance()->getSerializer($speaker, $serializer_type)->serialize
|
||||
(
|
||||
Request::input('expand', ''),
|
||||
[],
|
||||
[],
|
||||
[
|
||||
'summit_id' => $summit_id,
|
||||
'published' => Request::input('published', false),
|
||||
'summit' => $summit
|
||||
]
|
||||
)
|
||||
);
|
||||
|
||||
} catch (ValidationException $ex1) {
|
||||
Log::warning($ex1);
|
||||
return $this->error412($ex1->getMessages());
|
||||
} catch (EntityNotFoundException $ex2) {
|
||||
Log::warning($ex2);
|
||||
return $this->error404(array('message' => $ex2->getMessage()));
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex);
|
||||
return $this->error500($ex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
|
@ -169,7 +169,6 @@ Route::group([
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Route::get('entity-events', 'OAuth2SummitApiController@getSummitEntityEvents');
|
||||
|
||||
// attendees
|
||||
@ -223,9 +222,10 @@ Route::group([
|
||||
|
||||
Route::post('', [ 'middleware' => 'auth.user:administrators|summit-front-end-administrators', 'uses' => 'OAuth2SummitSpeakersApiController@addSpeakerBySummit']);
|
||||
Route::get('', 'OAuth2SummitSpeakersApiController@getSpeakers');
|
||||
Route::get('me', 'OAuth2SummitSpeakersApiController@getMySummitSpeaker');
|
||||
|
||||
Route::group(['prefix' => '{speaker_id}'], function () {
|
||||
Route::get('', 'OAuth2SummitSpeakersApiController@getSummitSpeaker')->where('speaker_id', 'me|[0-9]+');
|
||||
Route::get('', 'OAuth2SummitSpeakersApiController@getSummitSpeaker')->where('speaker_id', '[0-9]+');
|
||||
Route::put('', [ 'middleware' => 'auth.user:administrators|summit-front-end-administrators', 'uses' => 'OAuth2SummitSpeakersApiController@updateSpeakerBySummit'])->where('speaker_id', 'me|[0-9]+');
|
||||
});
|
||||
});
|
||||
|
@ -23,6 +23,11 @@ interface ISummitRepository extends IBaseRepository
|
||||
*/
|
||||
public function getCurrent();
|
||||
|
||||
/**
|
||||
* @return Summit
|
||||
*/
|
||||
public function getCurrentAndAvailable();
|
||||
|
||||
/**
|
||||
* @return Summit
|
||||
*/
|
||||
|
@ -32,7 +32,6 @@ final class DoctrineSummitRepository
|
||||
->select("s")
|
||||
->from(\models\summit\Summit::class, "s")
|
||||
->where('s.active = 1')
|
||||
->andWhere('s.available_on_api = 1')
|
||||
->orderBy('s.begin_date', 'DESC')
|
||||
->getQuery()
|
||||
->getResult();
|
||||
@ -121,4 +120,21 @@ final class DoctrineSummitRepository
|
||||
if (count($res) == 0) return null;
|
||||
return $res[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Summit
|
||||
*/
|
||||
public function getCurrentAndAvailable()
|
||||
{
|
||||
$res = $this->getEntityManager()->createQueryBuilder()
|
||||
->select("s")
|
||||
->from(\models\summit\Summit::class, "s")
|
||||
->where('s.active = 1')
|
||||
->andWhere('s.available_on_api = 1')
|
||||
->orderBy('s.begin_date', 'DESC')
|
||||
->getQuery()
|
||||
->getResult();
|
||||
if (count($res) == 0) return null;
|
||||
return $res[0];
|
||||
}
|
||||
}
|
@ -25,9 +25,11 @@ final class SummitScopes
|
||||
|
||||
const WriteSummitData = '%s/summits/write';
|
||||
const WriteSpeakersData = '%s/speakers/write';
|
||||
const ReadSpeakersData = '%s/speakers/read';
|
||||
const WriteTrackTagGroupsData = '%s/track-tag-groups/write';
|
||||
const WriteTrackQuestionTemplateData = '%s/track-question-templates/write';
|
||||
const WriteMySpeakersData = '%s/speakers/write/me';
|
||||
const ReadMySpeakersData = '%s/speakers/read/me';
|
||||
|
||||
const PublishEventData = '%s/summits/publish-event';
|
||||
const WriteEventData = '%s/summits/write-event';
|
||||
|
@ -436,15 +436,24 @@ class ApiEndpointsSeeder extends Seeder
|
||||
sprintf(SummitScopes::WriteSpeakersData, $current_realm),
|
||||
],
|
||||
],
|
||||
array(
|
||||
[
|
||||
'name' => 'get-speaker-by-summit',
|
||||
'route' => '/api/v1/summits/{id}/speakers/{speaker_id}',
|
||||
'http_method' => 'GET',
|
||||
'scopes' => [
|
||||
sprintf(SummitScopes::ReadSummitData, $current_realm),
|
||||
sprintf(SummitScopes::ReadSpeakersData, $current_realm),
|
||||
sprintf(SummitScopes::ReadAllSummitData, $current_realm)
|
||||
],
|
||||
),
|
||||
],
|
||||
[
|
||||
'name' => 'get-my/speaker-by-summit',
|
||||
'route' => '/api/v1/summits/{id}/speakers/me',
|
||||
'http_method' => 'GET',
|
||||
'scopes' => [
|
||||
sprintf(SummitScopes::ReadMySpeakersData, $current_realm),
|
||||
sprintf(SummitScopes::ReadAllSummitData, $current_realm)
|
||||
],
|
||||
],
|
||||
array(
|
||||
'name' => 'add-speaker-feedback',
|
||||
'route' => '/api/v1/summits/{id}/speakers/{speaker_id}/presentations/{presentation_id}/feedback',
|
||||
|
@ -121,11 +121,21 @@ final class ApiScopesSeeder extends Seeder
|
||||
'short_description' => 'Write Speakers Data',
|
||||
'description' => 'Grants write access for Speakers Data',
|
||||
],
|
||||
[
|
||||
'name' => sprintf(SummitScopes::ReadSpeakersDataSpeakersData, $current_realm),
|
||||
'short_description' => 'Read Speakers Data',
|
||||
'description' => 'Grants read access for Speakers Data',
|
||||
],
|
||||
[
|
||||
'name' => sprintf(SummitScopes::WriteMySpeakersData, $current_realm),
|
||||
'short_description' => 'Write My Speakers Profile Data',
|
||||
'description' => 'Grants write access for My Speaker Profile Data',
|
||||
],
|
||||
[
|
||||
'name' => sprintf(SummitScopes::ReadMySpeakersData, $current_realm),
|
||||
'short_description' => 'Read My Speakers Profile Data',
|
||||
'description' => 'Grants read access for My Speaker Profile Data',
|
||||
],
|
||||
[
|
||||
'name' => sprintf(SummitScopes::WriteAttendeesData, $current_realm),
|
||||
'short_description' => 'Write Attendees Data',
|
||||
|
Loading…
x
Reference in New Issue
Block a user