* customer_id search param now has the same search logic
as the rest as it had before 'null' detection and conversion
=> 'undef' whereas it's not needed anymore because it's now
supported globally. The change also fixes an empty response
issue.
Change-Id: If95de44d16ca2871da72d0ee019850802a3a94dd
* Role/Entities*: POST/PUT/PATCH/DELETE methods changes:
- support deadlock detection and transaction retry
(2 retry attempts at the moment)
- improve transaction control, use local $guard
instead of saving the ref to $c->stash, as in that
case it went out of scope too late and also reported
an error message into the log about abnormal $guard out
of scope interruption
- move all non transaction related code outside
of the scope
- add error handling when methods such as update_item,
and a like do not return the expected data, instead of
simply going out of scope and resulting in an uncontrolled
reply
* Role/API:
- rework transaction control:
+ get_transaction_control() is renamed to start_transaction()
to better reflect what it does
+ complete_transaction() is renamed to commit_transaction()
+ remove unused %params arg
+ pass $guard into commit_transaction() instead of having it
stored as $c->stash->{transaction_guard) that caused the $guard
ref to be destroyed much late than expected
(there was also a typo as transaction_quard,
which is not relevant anymore with the changes
+ add check_deadlock() that is invoked when an exception is caught
or an $c->errors contain an error, and if the error message
represents a transaction error, the transaction block is
re-invoked via "goto TX_START"
- rework error():
+ it now accepts args as following:
($self, $c, $code, $message, @errors)
# code -> returned as HTTP code in the reply
# message -> returned as HTTP message in the reply
# errors -> contain errors for internal logging, last element often contains a DBIx exception
+ populates all @errors into $c->error so they are available on
demend in the code via $c->error or $c->last_error
+ $c->log->error is not invoked now as the errors become printed
in log_response()
- log_response() now prints collected errors from $c->error correctly
as a separate log line, that is alike to the other api logs so that
those can be looked up by the request's tx_id, also all errors are
now printed only into api.log
* Adjust all $self->error() calls in catch($e) to include $e as the last
argument, as well as the duplicate $c->log->error is removed from
those ocassions
* Remove all $c->log->error() calls as they are replaced with either
$self->error() (that logs it correctly into api.log) or
$c->error('err') that also adds it correctly into api.log
* API::CallForwards: rework to use Entities/EntitiesItem
* API::Contracts: rework POST to use Entities
* API::PeeringGroups: rework POST to use Entities
* API::SubscriberRegistrations: rework POST to use Entities
* API::RewriteRuleSets: improve create_item() functionality
* Utils/Message: add 'api_retry' log type
* $c->session->{api_request_tx_id} is changed to
$c->stash->{api_request_tx_id} because sometimes the session
ref is different and a different tx_id becomes used
Change-Id: I633ce7a8047b1bf00a2f6889003088edf0825dcd
* get_handlers_rs() is renamed into get_file_handles() and
reworked from an indented 'from' resultset into 2 separate
resultsets, one fetching all the handles and another one
files for the sound set, it is now returned as an array with the
similar data. Reason for this rework is the deprecated use of
'from', that resulted in a lot of warnings in panel-fcgi.log:
DBIx::Class::SQLMaker::ClassicExtensions::_join_condition():
ResultSet {from} structures with conditions not conforming to the
SQL::Abstract::Classic syntax are deprecated: you either need to
stop abusing {from} altogether, or express the condition properly
using the { -ident => ... }
* adjust file_handles data key names to better follow the
naming conventions and readability, e.g.: groupname -> group_name,
fileid -> file_id
Change-Id: Ia91c9104c0b4dc79ee5bc359eb0b6e035e56ef3e
- all standard LIKE search are migrated
- will avoid LIKE unless a pattern (* wildcard) is
used as a search term. this encourage db index
usage, will be faster
- supports wildcard escape sequence \\*
- harmonize swagger UI descriptions of filters
Change-Id: Iea155871c9be6c284e6970a562d4e6af73fedc4b
* as changes to sound sets and sound files cause
internal triggers + SP to be invoked, the gap
locking should be reduced to avoid possible
deadlocks, hence READ COMMITTED transaction
isolation level is used for all sound sets
and sound files change operations.
* fix a condition that caused an evaluation error
when both old_parent_id and parent_id are undef.
Change-Id: I7e69a0a0e5878c03b086977933315e532aaa2a29
* uses prefix 'me.' for query types search_eq and search_like
in the where condition to avoid ambiguity if the search_rs
has joins that with the same column names
Change-Id: I90fef80970aa4415480b00bbed2fb9fbee1f1ccc
* when customer_id query param is specified as customer_id=null
or customer_id=NULL it now correctly fetches soundsets that
do not have customer_id assigned to them
Change-Id: I8de3d9615c133c2abd3eb2b5f4fea8de5b652417
* Contract default sound set - subscriber propagation for cases:
- New customer sound set is created as default.
- Customer sound set is changed to default.
- New subscriber creation - setting contract default sound set id.
* The mentioned cases were implemented for both UI and API.
Change-Id: Ia4733c972ae388d3457d0336e3f85b85eec6e9a2
* colelction_nav_links() should be used instead of the old
self/prev/next href link code
* Entities.pm fix colletion_nav_links() to pass missing
$c->request->params
* collection_nav_links() use default $c->request->path and
$c->request->params if those arguments are not specified
Change-Id: Icca5afac812f2e06e6927ba6f4e91057f9745d21
This patch reuses existing forms by clearing them, rather than
re-instantiating them again and again.
Also, panel start time should be better due to less package
pre-loading.
Change-Id: Ia3e64fd4b4084bb5ec35a669c5840c9fc3c58f2e
the factory Catalyst::ActionRole::HTTPMethods action role
is set for any action, and in race with our own
NGCP::Panel::Role::HTTPMethods. the testcase could have
been misleading ever since, as it uses DELETE /api/customers,
which was present when implemting the method override initially,
but dropped on the road to 4.5.
the issue is resolved by overriding
Catalyst::Controller::gather_default_action_roles.
until the class hierachy refactoring is completed, only
consistent way is to add the override to each api controller.
the action_roles config attribute can therefore be
removed.
using Plack::Middleware::MethodOverride as an alternative from
upstream has the drawback to work only with POST. but a required
usecase is to also support translation DELETE requests to PATCH.
Change-Id: I204ba59869a8327bdd5db8a867fbbb061d1c9e7c
which implies, among others, strict and warnings. these should never
be omitted and are one of the most frequent complaints of perlcritic
currently.
as a result TryCatch can be removed (imported by Sipwise::Base).
also, "no Moose" is removed (has no effect).
Change-Id: I901b6a9f0f6d426f62b73e68f2c5ad6365c1eeef
Switch from the discouraged base module to the light-weight parent module.
Also remove some surrounding BEGIN blocks from 'use parent' which are
completely unnecessary.
Change-Id: I3a669e8024f098819be45030ca9d1afa8756105c
-enhanced test detail: did not detect missing CRUD operations yet
-query param 'operation' didn't work for 'recent' yournal entry of all API resources so far
-fix of several copy paste errors in existing rest api code
-...
Change-Id: I71b54212d8126b0280fcad2e568fad52a673cbf0