TT#180551 /api/topuplogs add filter by customer_id

* customer_id filter is now possible, which behaves the same as the
  existing contract_id. This is to add consistency as filtering by
  customer_id is available in other endpoints

Change-Id: I1577d06133f9629c363940a4e8d2fb8012336e21
mr11.0
Kirill Solomko 3 years ago
parent e4803b50b3
commit 22eb317b70

@ -70,7 +70,7 @@ sub query_params {
},
second => sub { },
},
},
},
{
param => 'contract_id',
description => 'Filter for top-up requests of a specific customer contract.',
@ -82,7 +82,18 @@ sub query_params {
second => sub {},
},
},
{
{
param => 'customer_id',
description => 'Filter for top-up requests of a specific customer contract.',
query => {
first => sub {
my $q = shift;
return { 'me.contract_id' => $q };
},
second => sub {},
},
},
{
param => 'subscriber_id',
description => 'Filter for top-up requests of a specific subscriber.',
query => {
@ -93,7 +104,7 @@ sub query_params {
second => sub {},
},
},
{
{
param => 'voucher_id',
description => 'Filter for top-up requests with a specific voucher.',
query => {

@ -17,7 +17,7 @@ sub _item_rs {
my $item_rs = $c->model('DB')->resultset('topup_logs');
if($c->user->roles eq "admin") {
} elsif($c->user->roles eq "reseller") {
} elsif ($c->user->roles eq "reseller") {
$item_rs = $item_rs->search({
'contact.reseller_id' => $c->user->reseller_id,
},{

Loading…
Cancel
Save