openstackid-resources/app/Models/Foundation/Summit/Locations/SummitBookableVenueRoomAttributeValue.php
smarcet a1b8c46273 Added enpoints to CRUD bookable rooms
Add bookable room to summit

POST /api/v1/summits/{id}/locations/venues/{venue_id}/bookable-rooms

payload

time_slot_cost: required|numeric
currency:required|iso_currency_code(USD,EUR)
capacity:required|integer
floor_id:sometimes|integer
name:sometimes|string|max:255
description:sometimes|string
order:sometimes|integer|min:1

update bookable room per summit

PUT /api/v1/summits/{id}/locations/venues/{venue_id}/bookable-rooms/{room_id}

payload

time_slot_cost: required|numeric
currency:required|iso_currency_code(USD,EUR)
capacity:required|integer
floor_id:sometimes|integer
name:sometimes|string|max:255
description:sometimes|string
order:sometimes|integer|min:1

delete bookable room

DELETE /api/v1/summits/{id}/locations/venues/{venue_id}/bookable-rooms/{room_id}

add attribute value to bookable room

PUT /api/v1/summits/{id}/locations/venues/{venue_id}/bookable-rooms/{room_id}/attributes/{attribute_id}

delete attribute value from bookable room

DELETE /api/v1/summits/{id}/locations/venues/{venue_id}/bookable-rooms/{room_id}/attributes/{attribute_id}

Added missing endpoints to CRUD bookable rooms attributes
per summit

Get all bookable rooms attribute types

GET /api/v1/summits/{id}/bookable-room-attribute-types

Get bookable room attribute type by id

GET /api/v1/summits/{id}/bookable-room-attribute-types/{type_id}

Add bookable room attribute type

POST /api/v1/summits/{id}/bookable-room-attribute-types

payload

type [required|string]

Update bookable room attribute type

PUT /api/v1/summits/{id}/bookable-room-attribute-types/{type_id}

payload

type [required|string]

delete attribute type by id

DELETE /api/v1/summits/{id}/bookable-room-attribute-types/{type_id}

get all attribute values by attribute type

GET /api/v1/summits/{id}/bookable-room-attribute-types/{type_id}/values

add attribute value to attribute type

POST /api/v1/summits/{id}/bookable-room-attribute-types/{type_id}/values

payload

value [required|string]

update attribute value

PUT /api/v1/summits/{id}/bookable-room-attribute-types/{type_id}/values/{value_id}

payload

value [required|string]

delete attribute value by id

DELETE /api/v1/summits/{id}/bookable-room-attribute-types/{type_id}/values/{value_id}

refund endpoint (admin only)

DELETE /api/v1/summits/{id}/bookable-rooms/{room_id}/reservations/{reservation_id}/refund

payload

amount [numeric|required]

get all reservations by summit (admin)

GET /api/v1/summits/{id}/locations/bookable-rooms/all/reservations

query params

page:integer|min:1
per_page:required_with:page|integer|min:1|max:100
filter:

allowed filters

summit_id: ['==']
room_name: ['==', '=@']
room_id: ['==']
owner_id: ['==']
status:  ['==']
start_datetime: ['>', '<', '<=', '>=', '==']
end_datetime:  ['>', '<', '<=', '>=', '==']

order

allowed ordering

id,start_datetime,end_datetime

Change-Id: Ic7f6ed7defaf20b8799a7d94beb0a82103b206f0
2019-06-19 18:19:58 -03:00

84 lines
2.3 KiB
PHP

<?php namespace models\summit;
/**
* Copyright 2019 OpenStack Foundation
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Criteria;
use Doctrine\ORM\Mapping AS ORM;
use models\exceptions\ValidationException;
use models\utils\SilverstripeBaseModel;
/**
* @ORM\Entity(repositoryClass="App\Repositories\Summit\DoctrineSummitBookableVenueRoomAttributeValueRepository")
* @ORM\Table(name="SummitBookableVenueRoomAttributeValue")
* Class SummitBookableVenueRoomAttributeValue
* @package models\summit
*/
class SummitBookableVenueRoomAttributeValue extends SilverstripeBaseModel
{
/**
* @ORM\Column(name="Value", type="string")
* @var string
*/
private $value;
/**
* @ORM\ManyToOne(targetEntity="models\summit\SummitBookableVenueRoomAttributeType", inversedBy="values")
* @ORM\JoinColumn(name="TypeID", referencedColumnName="ID")
* @var SummitBookableVenueRoomAttributeType
*/
private $type;
/**
* @return string
*/
public function getValue(): string
{
return $this->value;
}
/**
* @param string $value
*/
public function setValue(string $value): void
{
$this->value = $value;
}
/**
* @return SummitBookableVenueRoomAttributeType
*/
public function getType(): SummitBookableVenueRoomAttributeType
{
return $this->type;
}
/**
* @param SummitBookableVenueRoomAttributeType $type
*/
public function setType(SummitBookableVenueRoomAttributeType $type): void
{
$this->type = $type;
}
/**
* @return int
*/
public function getTypeId():int{
try {
return is_null($this->type) ? 0 : $this->type->getId();
}
catch(\Exception $ex){
return 0;
}
}
}