Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,17 @@ public static function build(array $data, $update = false){
}

$base_rules = [
'name' => $name_rule,
'color' => 'sometimes|hex_color',
'black_out_times' => 'sometimes|boolean',
'use_sponsors' => 'sometimes|boolean',
'are_sponsors_mandatory' => 'sometimes|boolean|required_with:use_sponsors',
'allows_attachment' => 'sometimes|boolean',
'allows_level' => 'sometimes|boolean',
'is_private' => 'sometimes|boolean',
'is_default' => 'sometimes|boolean',
'name' => $name_rule,
'color' => 'sometimes|hex_color',
'black_out_times' => 'sometimes|boolean',
'use_sponsors' => 'sometimes|boolean',
'are_sponsors_mandatory' => 'sometimes|boolean|required_with:use_sponsors',
'allows_attachment' => 'sometimes|boolean',
'allows_level' => 'sometimes|boolean',
'allows_location' => 'sometimes|boolean',
'allows_publishing_dates' => 'sometimes|boolean',
'is_private' => 'sometimes|boolean',
'is_default' => 'sometimes|boolean',
];

$specific_rules = [];
Expand All @@ -75,11 +77,12 @@ public static function build(array $data, $update = false){
'min_moderators' => 'sometimes|integer|required_with:use_moderator',
'max_moderators' => 'sometimes|integer|required_with:use_moderator|greater_than_field:min_moderators',
'should_be_available_on_cfp' => 'sometimes|boolean',
'moderator_label' => 'sometimes|string'
'moderator_label' => 'sometimes|string',
'allow_custom_ordering' => 'sometimes|boolean',
'allow_attendee_vote' => 'sometimes|boolean',
];
}
break;

}
return array_merge($base_rules, $specific_rules);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ public static function build(array $data, $update = false){
'name' => 'required|string',
'description' => 'sometimes|string',
'color' => 'sometimes|hex_color',
'max_attendee_votes' => 'sometimes|integer|min:0',
'begin_attendee_voting_period_date' => 'sometimes|date_format:U',
'end_attendee_voting_period_date' => 'sometimes|date_format:U|required_with:submission_begin_date|after:begin_attendee_voting_period_date',
];

if($update){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
* limitations under the License.
**/


/**
* Class SummitEventValidationRulesFactory
* @package App\Http\Controllers
Expand Down Expand Up @@ -66,6 +65,7 @@ public static function build(array $data, bool $update = false): array
'disclaimer_accepted' => 'sometimes|boolean',
'created_by_id' => 'sometimes|integer',
'show_sponsors' => 'sometimes|boolean',
'custom_order' => 'sometimes|integer',
];
}

Expand Down Expand Up @@ -99,6 +99,7 @@ public static function build(array $data, bool $update = false): array
'moderator_speaker_id' => 'sometimes|integer',
'extra_questions' => 'sometimes|extra_question_dto_array',
'links' => 'sometimes|url_array',
'custom_order' => 'sometimes|integer',
// group event
'groups' => 'sometimes|int_array',
'selection_plan_id' => 'sometimes|integer',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1289,4 +1289,97 @@ public function importAssetsFromMUX($summit_id)
}
}

/**
* Attendees Votes
*/

/**
* @param $summit_id
* @param $presentation_id
* @return \Illuminate\Http\JsonResponse|mixed
*/
public function getAttendeeVotes($summit_id, $presentation_id){
try {

$summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id);
if (is_null($summit)) return $this->error404();

return $this->ok();
} catch (EntityNotFoundException $ex1) {
Log::warning($ex1);
return $this->error404();
} catch (ValidationException $ex2) {
Log::warning($ex2);
return $this->error412($ex2->getMessages());
} catch (Exception $ex) {
Log::error($ex);
return $this->error500($ex);
}
}

/**
* @param $summit_id
* @param $presentation_id
* @return \Illuminate\Http\JsonResponse|mixed
*/
public function castAttendeeVote($summit_id, $presentation_id){
try {

$summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id);
if (is_null($summit)) return $this->error404();

$current_member = $this->resource_server_context->getCurrentUser();
if (is_null($current_member)) return $this->error403();

$vote = $this->presentation_service->castAttendeeVote($summit, $current_member, intval($presentation_id));

return $this->created(SerializerRegistry::getInstance()->getSerializer
($vote)
->serialize
(
self::getExpands(),
self::getFields(),
self::getRelations()
)
);
} catch (EntityNotFoundException $ex1) {
Log::warning($ex1);
return $this->error404();
} catch (ValidationException $ex2) {
Log::warning($ex2);
return $this->error412($ex2->getMessages());
} catch (Exception $ex) {
Log::error($ex);
return $this->error500($ex);
}
}

/**
* @param $summit_id
* @param $presentation_id
* @return \Illuminate\Http\JsonResponse|mixed
*/
public function unCastAttendeeVote($summit_id, $presentation_id){
try {

$summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id);
if (is_null($summit)) return $this->error404();

$current_member = $this->resource_server_context->getCurrentUser();
if (is_null($current_member)) return $this->error403();

$this->presentation_service->unCastAttendeeVote($summit, $current_member, intval($presentation_id));

return $this->deleted();
} catch (EntityNotFoundException $ex1) {
Log::warning($ex1);
return $this->error404();
} catch (ValidationException $ex2) {
Log::warning($ex2);
return $this->error412($ex2->getMessages());
} catch (Exception $ex) {
Log::error($ex);
return $this->error500($ex);
}
}
}
Loading