added endpoint to create summit
POST /api/v1/summits Payload * name (required|string|max:50) * start_date (required|date_format:U) * end_date (required_with:start_date|date_format:U|after:start_date) * submission_begin_date (sometimes|date_format:U) * submission_end_date (required_with:submission_begin_date|date_format:U|after:submission_begin_date) * voting_begin_date (sometimes|date_format:U) * voting_end_date (required_with:voting_begin_date|date_format:U|after:voting_begin_date) * selection_begin_date (sometimes|date_format:U) * selection_end_date (required_with:selection_begin_date|date_format:U|after:selection_begin_date) * registration_begin_date (sometimes|date_format:U) * registration_end_date (required_with:registration_begin_date|date_format:U|after:registration_begin_date) * start_showing_venues_date (sometimes|date_format:U|before:start_date) * schedule_start_date (sometimes|date_format:U) * active (sometimes|boolean) * dates_label (sometimes|string) * time_zone_id (required|timezone) check http://php.net/manual/en/timezones.php * external_summit_id (sometimes|string) * available_on_api (sometimes|boolean) * calendar_sync_name (sometimes|string|max:255) * calendar_sync_desc (sometimes|string) * link (sometimes|url) * registration_link (sometimes|url) * max_submission_allowed_per_user (sometimes|integer|min:1) Change-Id: Ia1ff04d728f53a3869724574fad4fee027049f04
This commit is contained in:
@@ -196,4 +196,29 @@ interface ISummitService
|
||||
* @return bool
|
||||
*/
|
||||
public function updateEvents(Summit $summit, array $data);
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
* @throws ValidationException
|
||||
* @throws EntityNotFoundException
|
||||
* @return Summit
|
||||
*/
|
||||
public function addSummit(array $data);
|
||||
|
||||
/**
|
||||
* @param int $summit_id
|
||||
* @param array $data
|
||||
* @throws ValidationException
|
||||
* @throws EntityNotFoundException
|
||||
* @return Summit
|
||||
*/
|
||||
public function updateSummit($summit_id, array $data);
|
||||
|
||||
/**
|
||||
* @param int $summit_id
|
||||
* @throws ValidationException
|
||||
* @throws EntityNotFoundException
|
||||
* @return void
|
||||
*/
|
||||
public function deleteSummit($summit_id);
|
||||
}
|
||||
@@ -16,7 +16,9 @@ use App\Events\MyFavoritesRemove;
|
||||
use App\Events\MyScheduleAdd;
|
||||
use App\Events\MyScheduleRemove;
|
||||
use App\Http\Utils\FileUploader;
|
||||
use App\Models\Foundation\Summit\Factories\SummitFactory;
|
||||
use App\Models\Utils\IntervalParser;
|
||||
use App\Models\Utils\TimeZoneUtils;
|
||||
use App\Services\Model\AbstractService;
|
||||
use App\Services\Model\IFolderService;
|
||||
use Doctrine\DBAL\Exception\UniqueConstraintViolationException;
|
||||
@@ -44,6 +46,7 @@ use models\summit\ISummitAttendeeRepository;
|
||||
use models\summit\ISummitAttendeeTicketRepository;
|
||||
use models\summit\ISummitEntityEventRepository;
|
||||
use models\summit\ISummitEventRepository;
|
||||
use models\summit\ISummitRepository;
|
||||
use models\summit\Presentation;
|
||||
use models\summit\PresentationType;
|
||||
use models\summit\Summit;
|
||||
@@ -72,9 +75,7 @@ use DateInterval;
|
||||
* Class SummitService
|
||||
* @package services\model
|
||||
*/
|
||||
final class SummitService
|
||||
extends AbstractService
|
||||
implements ISummitService
|
||||
final class SummitService extends AbstractService implements ISummitService
|
||||
{
|
||||
|
||||
/**
|
||||
@@ -148,8 +149,14 @@ final class SummitService
|
||||
*/
|
||||
private $group_repository;
|
||||
|
||||
/**
|
||||
* @var ISummitRepository
|
||||
*/
|
||||
private $summit_repository;
|
||||
|
||||
/**
|
||||
* SummitService constructor.
|
||||
* @param ISummitRepository $summit_repository
|
||||
* @param ISummitEventRepository $event_repository
|
||||
* @param ISpeakerRepository $speaker_repository
|
||||
* @param ISummitEntityEventRepository $entity_events_repository
|
||||
@@ -167,6 +174,7 @@ final class SummitService
|
||||
*/
|
||||
public function __construct
|
||||
(
|
||||
ISummitRepository $summit_repository,
|
||||
ISummitEventRepository $event_repository,
|
||||
ISpeakerRepository $speaker_repository,
|
||||
ISummitEntityEventRepository $entity_events_repository,
|
||||
@@ -184,6 +192,7 @@ final class SummitService
|
||||
)
|
||||
{
|
||||
parent::__construct($tx_service);
|
||||
$this->summit_repository = $summit_repository;
|
||||
$this->event_repository = $event_repository;
|
||||
$this->speaker_repository = $speaker_repository;
|
||||
$this->entity_events_repository = $entity_events_repository;
|
||||
@@ -1472,4 +1481,63 @@ final class SummitService
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
* @throws ValidationException
|
||||
* @throws EntityNotFoundException
|
||||
* @return Summit
|
||||
*/
|
||||
public function addSummit(array $data)
|
||||
{
|
||||
return $this->tx_service->transaction(function () use ($data) {
|
||||
|
||||
$name = trim($data['name']);
|
||||
$former_summit = $this->summit_repository->getByName($name);
|
||||
if(!is_null($former_summit)){
|
||||
throw new ValidationException
|
||||
(
|
||||
trans
|
||||
(
|
||||
'validation_errors.SummitService.AddSummit.NameAlreadyExists',
|
||||
['name' => $name]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$summit = SummitFactory::build($data);
|
||||
|
||||
$this->summit_repository->add($summit);
|
||||
|
||||
return $summit;
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $summit_id
|
||||
* @param array $data
|
||||
* @throws ValidationException
|
||||
* @throws EntityNotFoundException
|
||||
* @return Summit
|
||||
*/
|
||||
public function updateSummit($summit_id, array $data)
|
||||
{
|
||||
return $this->tx_service->transaction(function () use ($summit_id, $data) {
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $summit_id
|
||||
* @throws ValidationException
|
||||
* @throws EntityNotFoundException
|
||||
* @return void
|
||||
*/
|
||||
public function deleteSummit($summit_id)
|
||||
{
|
||||
return $this->tx_service->transaction(function () use ($summit_id) {
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user