openstackid-resources/app/Jobs/SynchAllPresentationActions.php
smarcet 0d836a1b90 Summit Presentation Actions Types
Updates to Summit Serializer

* added new collection presentation_action_types

Presentation Action Types

GET /api/v1/summits/{id}/presentation-action-types

filtering

'label' => ['=@', '=='],

ordering

'id',
'order',
'label',

required scopes

%s/summits/read
%s/summits/read/all

auth groups

* SuperAdmins
* Administrators
* SummitAdministrators
* TrackChairsAdmins

GET /api/v1/summits/{id}/presentation-action-types/csv

filtering

'name' => ['=@', '=='],
'label' => ['=@', '=='],
'is_enabled' => ['=='],

ordering

'id',
'order',
'label',

required scopes

%s/summits/read
%s/summits/read/all

auth groups

* SuperAdmins
* Administrators
* SummitAdministrators
* TrackChairsAdmins

POST /api/v1/summits/{id}/presentation-action-types

payload

'label'       => 'required|string|max:255',

required scopes

%s/summits/write

auth groups

* SuperAdmins
* Administrators
* SummitAdministrators
* TrackChairsAdmins

PUT /api/v1/summits/{id}/presentation-action-types/{action_id}

payload

'label'       => 'sometimes|string|max:255',
'order'       => 'sometimes|integer|min:1',

required scopes

%s/summits/write

auth groups

* SuperAdmins
* Administrators
* SummitAdministrators
* TrackChairsAdmins

GET /api/v1/summits/{id}/presentation-action-types/{action_id}

required scopes

%s/summits/read
%s/summits/read/all

auth groups

* SuperAdmins
* Administrators
* SummitAdministrators
* TrackChairsAdmins

DELETE /api/v1/summits/{id}/presentation-action-types/{action_id}

required scopes

%s/summits/write

auth groups

* SuperAdmins
* Administrators
* SummitAdministrators
* TrackChairsAdmins

Change-Id: Ibec7591b88470b59d9f942a553a8335a57e9db9e
Signed-off-by: smarcet <smarcet@gmail.com>
2021-04-01 12:36:17 -03:00

68 lines
2.1 KiB
PHP

<?php namespace App\Jobs;
/**
* Copyright 2021 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 Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Log;
use libs\utils\ITransactionService;
use models\exceptions\EntityNotFoundException;
use models\summit\ISummitRepository;
/**
* Class SynchAllPresentationActions
* @package App\Jobs
*/
class SynchAllPresentationActions implements ShouldQueue
{
public $tries = 2;
public $timeout = PHP_INT_MAX;
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/**
* @var int
*/
private $summit_id;
/**
* SynchAllPresentationActions constructor.
* @param int $summit_id
*/
public function __construct(int $summit_id)
{
$this->summit_id = $summit_id;
}
/**
* @param ISummitRepository $repository
* @param ITransactionService $tx_service
* @throws \Exception
*/
public function handle(
ISummitRepository $repository,
ITransactionService $tx_service
)
{
Log::debug(sprintf("SynchAllPresentationActions::handle summit %s", $this->summit_id));
$tx_service->transaction(function() use($repository){
$summit = $repository->getById($this->summit_id);
if(is_null($summit))
throw new EntityNotFoundException(sprintf("Summit %s not found", $this->summit_id));
$summit->synchAllPresentationActions();
});
}
}