TT#30500 Fix /api/subscriberregistrations POST method

* POST method is adapted to the new behaviour of
      update_item() and fetch_item()

cherry-picked to mr5.5 (see TT#38607)

Change-Id: I35cc5d4e8c97cd415e9d6d31a6811d1f8cce84a9
(cherry picked from commit 53532fd5e8)
changes/28/21928/2
Kirill Solomko 8 years ago committed by Gerhard Jungwirth
parent e4b8bb235c
commit d5fb451e42

@ -163,7 +163,9 @@ sub POST :Allow {
my ($self, $c) = @_;
{
my $resource = $self->get_valid_post_data(
my ($item, $resource);
$resource = $self->get_valid_post_data(
c => $c,
media_type => 'application/json',
);
@ -171,7 +173,17 @@ sub POST :Allow {
my $form = $self->get_form($c);
my $create = 1;
my $item = $self->update_item($c, undef, undef, $resource, $form, $create);
my ($guard, $txn_ok) = ($c->model('DB')->txn_scope_guard, 0);
{
$self->update_item($c, undef, undef, $resource, $form, $create);
$guard->commit;
$txn_ok = 1;
}
last unless $txn_ok;
$item = $self->fetch_item($c, $resource, $form, $item);
last unless $item;
$c->response->status(HTTP_CREATED);
@ -187,5 +199,6 @@ sub end : Private {
$self->log_response($c);
}
1;
# vim: set tabstop=4 expandtab:

Loading…
Cancel
Save