
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
78 lines
2.4 KiB
PHP
78 lines
2.4 KiB
PHP
<?php namespace App\Repositories;
|
|
/**
|
|
* Copyright 2016 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\ORM\EntityManager;
|
|
use Doctrine\ORM\Mapping\ClassMetadata;
|
|
use Doctrine\ORM\QueryBuilder;
|
|
use Illuminate\Support\Facades\App;
|
|
use models\utils\SilverstripeBaseModel;
|
|
use LaravelDoctrine\ORM\Facades\Registry;
|
|
/**
|
|
* Class SilverStripeDoctrineRepository
|
|
* @package App\Repositories
|
|
*/
|
|
abstract class SilverStripeDoctrineRepository extends DoctrineRepository
|
|
{
|
|
|
|
/**
|
|
* Initializes a new <tt>EntityRepository</tt>.
|
|
*
|
|
* @param EntityManager $em The EntityManager to use.
|
|
* @param ClassMetadata $class The class descriptor.
|
|
*/
|
|
public function __construct($em, ClassMetadata $class)
|
|
{
|
|
$em = Registry::getManager(SilverstripeBaseModel::EntityManager);
|
|
parent::__construct($em, $class);
|
|
}
|
|
|
|
/**
|
|
* @return array
|
|
*/
|
|
protected function getFilterMappings()
|
|
{
|
|
return [];
|
|
}
|
|
|
|
/**
|
|
* @return array
|
|
*/
|
|
protected function getOrderMappings()
|
|
{
|
|
return [];
|
|
}
|
|
|
|
/**
|
|
* @param QueryBuilder $query
|
|
* @return QueryBuilder
|
|
*/
|
|
protected function applyExtraFilters(QueryBuilder $query){
|
|
return $query;
|
|
}
|
|
|
|
/**
|
|
* @param string $group_code
|
|
* @return bool
|
|
*/
|
|
protected static function isCurrentMemberOnGroup($group_code){
|
|
$resource_server_ctx = App::make(\models\oauth2\IResourceServerContext::class);
|
|
$member_repository = App::make(\models\main\IMemberRepository::class);
|
|
$member_id = $resource_server_ctx->getCurrentUserExternalId();
|
|
if(is_null($member_id)) return false;
|
|
$member = $member_repository->getById($member_id);
|
|
if (!is_null($member)){
|
|
return $member->isOnGroup($group_code);
|
|
}
|
|
return false;
|
|
}
|
|
} |