added missing RSVP fields to summit event

* rsvp_max_user_number
* rsvp_max_user_wait_list_number

Change-Id: Ib9a25941aab034c3407cd18ead7529b5705b596d
This commit is contained in:
Sebastian Marcet 2018-04-05 10:57:04 -03:00
parent 78db0e22ca
commit d38e5aa14a
3 changed files with 101 additions and 46 deletions

View File

@ -331,20 +331,22 @@ final class OAuth2SummitEventsApiController extends OAuth2ProtectedController
$data = Input::json();
$rules = [
'title' => 'required|string|max:100',
'description' => 'required|string',
'type_id' => 'required|integer',
'location_id' => 'sometimes|integer',
'start_date' => 'sometimes|required|date_format:U',
'end_date' => 'sometimes|required_with:start_date|date_format:U|after:start_date',
'track_id' => 'required|integer',
'rsvp_link' => 'sometimes|url',
'rsvp_template_id' => 'sometimes|integer',
'head_count' => 'sometimes|integer',
'social_description' => 'sometimes|string|max:100',
'allow_feedback' => 'sometimes|boolean',
'tags' => 'sometimes|string_array',
'sponsors' => 'sometimes|int_array',
'title' => 'required|string|max:100',
'description' => 'required|string',
'type_id' => 'required|integer',
'location_id' => 'sometimes|integer',
'start_date' => 'sometimes|required|date_format:U',
'end_date' => 'sometimes|required_with:start_date|date_format:U|after:start_date',
'track_id' => 'required|integer',
'rsvp_link' => 'sometimes|url',
'rsvp_template_id' => 'sometimes|integer',
'rsvp_max_user_number' => 'required_with:rsvp_template_id|integer|min:0',
'rsvp_max_user_wait_list_number' => 'required_with:rsvp_template_id|integer|min:0',
'head_count' => 'sometimes|integer',
'social_description' => 'sometimes|string|max:100',
'allow_feedback' => 'sometimes|boolean',
'tags' => 'sometimes|string_array',
'sponsors' => 'sometimes|int_array',
// presentation rules
'attendees_expected_learnt' => 'sometimes|string|max:1000',
'feature_cloud' => 'sometimes|boolean',
@ -367,12 +369,12 @@ final class OAuth2SummitEventsApiController extends OAuth2ProtectedController
);
}
$fields = array
(
$fields = [
'title',
'description',
'social_summary',
);
];
$event = $this->service->addEvent($summit, HTMLCleaner::cleanData($data->all(), $fields));
@ -413,6 +415,8 @@ final class OAuth2SummitEventsApiController extends OAuth2ProtectedController
'description' => 'sometimes|string',
'rsvp_link' => 'sometimes|url',
'rsvp_template_id' => 'sometimes|integer',
'rsvp_max_user_number' => 'required_with:rsvp_template_id|integer|min:0',
'rsvp_max_user_wait_list_number' => 'required_with:rsvp_template_id|integer|min:0',
'head_count' => 'sometimes|integer',
'social_description' => 'sometimes|string|max:100',
'location_id' => 'sometimes|integer',

View File

@ -19,26 +19,27 @@ use models\summit\SummitEvent;
*/
class SummitEventSerializer extends SilverStripeSerializer
{
protected static $array_mappings = array
(
'Title' => 'title:json_string',
'Abstract' => 'description:json_string',
'SocialSummary' => 'social_description:json_string',
'StartDate' => 'start_date:datetime_epoch',
'EndDate' => 'end_date:datetime_epoch',
'LocationId' => 'location_id:json_int',
'SummitId' => 'summit_id:json_int',
'TypeId' => 'type_id:json_int',
'ClassName' => 'class_name',
'AllowFeedBack' => 'allow_feedback:json_boolean',
'AvgFeedbackRate' => 'avg_feedback_rate:json_float',
'Published' => 'is_published:json_boolean',
'HeadCount' => 'head_count:json_int',
'RSVPLink' => 'rsvp_link:json_string',
'RSVPTemplateId' => 'rsvp_template_id:json_int',
'ExternalRSVP' => 'rsvp_external:json_boolean',
'CategoryId' => 'track_id:json_int',
);
protected static $array_mappings = [
'Title' => 'title:json_string',
'Abstract' => 'description:json_string',
'SocialSummary' => 'social_description:json_string',
'StartDate' => 'start_date:datetime_epoch',
'EndDate' => 'end_date:datetime_epoch',
'LocationId' => 'location_id:json_int',
'SummitId' => 'summit_id:json_int',
'TypeId' => 'type_id:json_int',
'ClassName' => 'class_name',
'AllowFeedBack' => 'allow_feedback:json_boolean',
'AvgFeedbackRate' => 'avg_feedback_rate:json_float',
'Published' => 'is_published:json_boolean',
'HeadCount' => 'head_count:json_int',
'RSVPLink' => 'rsvp_link:json_string',
'RSVPTemplateId' => 'rsvp_template_id:json_int',
'RSVPMaxUserNumber' => 'rsvp_max_user_number:json_int',
'RSVPMaxUserWaitListNumber' => 'rsvp_max_user_wait_list_number:json_int',
'ExternalRSVP' => 'rsvp_external:json_boolean',
'CategoryId' => 'track_id:json_int',
];
protected static $allowed_fields = [
@ -60,13 +61,14 @@ class SummitEventSerializer extends SilverStripeSerializer
'rsvp_external',
'track_id',
'rsvp_template_id',
'rsvp_max_user_number',
'rsvp_max_user_wait_list_number',
];
protected static $allowed_relations = array
(
protected static $allowed_relations = [
'sponsors',
'tags',
);
];
/**
* @param null $expand

View File

@ -94,18 +94,24 @@ class SummitEvent extends SilverstripeBaseModel
*/
protected $avg_feedback;
/**
* @ORM\Column(name="RSVPLink", type="string")
* @var string
*/
protected $rsvp_link;
/**
* @ORM\Column(name="HeadCount", type="integer")
* @var int
*/
protected $head_count;
/**
* @ORM\Column(name="RSVPMaxUserNumber", type="integer")
* @var int
*/
protected $rsvp_max_user_number;
/**
* @ORM\Column(name="RSVPMaxUserWaitListNumber", type="integer")
* @var int
*/
protected $rsvp_max_user_wait_list_number;
/**
* @ORM\ManyToOne(targetEntity="App\Models\Foundation\Summit\Events\RSVP\RSVPTemplate", fetch="EXTRA_LAZY")
* @ORM\JoinColumn(name="RSVPTemplateID", referencedColumnName="ID", onDelete="SET NULL")
@ -119,6 +125,12 @@ class SummitEvent extends SilverstripeBaseModel
*/
protected $rsvp;
/**
* @ORM\Column(name="RSVPLink", type="string")
* @var string
*/
protected $rsvp_link;
/**
* @ORM\ManyToOne(targetEntity="PresentationCategory", fetch="EXTRA_LAZY")
* @ORM\JoinColumn(name="CategoryID", referencedColumnName="ID", onDelete="SET NULL")
@ -197,10 +209,14 @@ class SummitEvent extends SilverstripeBaseModel
public function __construct()
{
parent::__construct();
$this->allow_feedback = false;
$this->published = false;
$this->avg_feedback = 0;
$this->head_count = 0;
$this->rsvp_max_user_number = 0;
$this->rsvp_max_user_wait_list_number = 0;
$this->tags = new ArrayCollection();
$this->feedback = new ArrayCollection();
$this->sponsors = new ArrayCollection();
@ -856,4 +872,37 @@ class SummitEvent extends SilverstripeBaseModel
public function getLocationName(){
return $this->hasLocation() ? $this->location->getName() : 'TBD';
}
/**
* @return int
*/
public function getRSVPMaxUserNumber()
{
return $this->rsvp_max_user_number;
}
/**
* @param int $rsvp_max_user_number
*/
public function setRSVPMaxUserNumber($rsvp_max_user_number)
{
$this->rsvp_max_user_number = $rsvp_max_user_number;
}
/**
* @return mixed
*/
public function getRSVPMaxUserWaitListNumber()
{
return $this->rsvp_max_user_wait_list_number;
}
/**
* @param mixed $rsvp_max_user_wait_list_number
*/
public function setRSVPMaxUserWaitListNumber($rsvp_max_user_wait_list_number)
{
$this->rsvp_max_user_wait_list_number = $rsvp_max_user_wait_list_number;
}
}