MT#60709 add PBX expand by device_id,profile_id,config_id

* device_id, profile_id (device related), config_id are now
  expandable in the respective /api/pbxdevice* endpoints.
* fix expand collection logic to avoid ambiguous 'order by id'.

Change-Id: I0b1f4b3da093fb04a30e5097881af6131c1afe46
mr13.0
Kirill Solomko 1 year ago
parent 78dfb7f7d8
commit b97be4502d

@ -19,6 +19,12 @@ has_field 'profile_id' => (
type => '+NGCP::Panel::Field::PosInteger',
required => 1,
label => 'Device Profile',
element_attr => {
expand => {
class => 'NGCP::Panel::Role::API::PbxDeviceProfiles',
allowed_roles => [qw(admin reseller subscriberadmin)],
},
},
);
has_field 'identifier' => (

@ -260,4 +260,24 @@ has_field 'rwr_set_id' => (
},
);
has_field 'device_id' => (
type => 'PosInteger',
element_attr => {
expand => {
class => 'NGCP::Panel::Role::API::PbxDeviceModels',
allowed_roles => [qw(admin reseller subscriberadmin)],
},
},
);
has_field 'config_id' => (
type => 'PosInteger',
element_attr => {
expand => {
class => 'NGCP::Panel::Role::API::PbxDeviceConfigs',
allowed_roles => [qw(admin reseller)],
},
},
);
1;

@ -1523,7 +1523,7 @@ sub get_expanded_field_data {
$class->item_rs($c)->search({
'me.id' => { '-in' => [keys %{$cache->{ids}}] },
},{
'order_by' => { '-asc' => 'id' },
'order_by' => { '-asc' => 'me.id' },
})->all();
$cache->{items_by_id} = \%items_by_id;
}

Loading…
Cancel
Save