* add dictionary support for fields that are expanded if encountered in all endpoints, with a possibility to override it, if defined on the endpoint's field level * move expand definitions from form fields into the Expand dictionary * simplify the expand usage, it now operates only with the <x>_id fields that are returned and visible in the response (e.g. if reseller_id is returned, then ?expand=reseller_id), the returned expand object name is <expand_field_name>_expand the, so in case of ?expand=reseller_id, the returned object will be reseller_id_expand * adapt Role/SystemContacts to work correctly with the expand functionality * expanded fields are returned as <expanded_field_name>_expand Change-Id: I4cab44ede9b40c70a95bbcedc81f58dd1f4e3b67mr10.2
parent
95e04a0db6
commit
8c556bbe36
@ -0,0 +1,74 @@
|
||||
package NGCP::Panel::Form::Expand;
|
||||
use HTML::FormHandler::Moose;
|
||||
use HTML::FormHandler::Widget::Wrapper::None;
|
||||
extends 'HTML::FormHandler';
|
||||
|
||||
has '+widget_wrapper' => ( default => 'None' );
|
||||
|
||||
sub build_render_list {[]}
|
||||
|
||||
has_field 'billing_profile_id' => (
|
||||
type => 'PosInteger',
|
||||
element_attr => {
|
||||
expand => {
|
||||
class => 'NGCP::Panel::Role::API::BillingProfiles',
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
has_field 'contact_id' => (
|
||||
type => 'PosInteger',
|
||||
element_attr => {
|
||||
expand => {
|
||||
class => 'NGCP::Panel::Role::API::CustomerContacts',
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
has_field 'contract_id' => (
|
||||
type => 'PosInteger',
|
||||
element_attr => {
|
||||
expand => {
|
||||
class => 'NGCP::Panel::Role::API::Contracts',
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
has_field 'customer_id' => (
|
||||
type => 'PosInteger',
|
||||
element_attr => {
|
||||
expand => {
|
||||
class => 'NGCP::Panel::Role::API::Customers',
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
has_field 'domain_id' => (
|
||||
type => 'PosInteger',
|
||||
element_attr => {
|
||||
expand => {
|
||||
class => 'NGCP::Panel::Role::API::Domains',
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
has_field 'reseller_id' => (
|
||||
type => 'PosInteger',
|
||||
element_attr => {
|
||||
expand => {
|
||||
class => 'NGCP::Panel::Role::API::Resellers',
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
has_field 'subscriber_id' => (
|
||||
type => 'PosInteger',
|
||||
element_attr => {
|
||||
expand => {
|
||||
class => 'NGCP::Panel::Role::API::Subscribers',
|
||||
remove_fields => [qw(password webpassword)],
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
1;
|
Loading…
Reference in new issue