You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ngcp-schema/lib/NGCP/Schema/Result/actual_billing_profiles.pm

56 lines
1.1 KiB

package NGCP::Schema::Result::actual_billing_profiles;
use strict;
use warnings;
use Scalar::Util qw(blessed);
use parent 'DBIx::Class::Core';
our $VERSION = '2.007';
__PACKAGE__->load_components("InflateColumn::DateTime", "Helper::Row::ToJSON");
__PACKAGE__->table("billing.v_actual_billing_profiles");
__PACKAGE__->add_columns(
"contract_id",
{
data_type => "integer",
extra => { unsigned => 1 },
is_foreign_key => 1,
is_nullable => 0,
},
"billing_profile_id",
{
data_type => "integer",
extra => { unsigned => 1 },
is_foreign_key => 1,
is_nullable => 0,
},
);
__PACKAGE__->set_primary_key("contract_id");
__PACKAGE__->belongs_to(
"contract",
"NGCP::Schema::Result::contracts",
{ id => "contract_id" },
{ cascade_copy => 0, cascade_delete => 0 },
);
__PACKAGE__->belongs_to(
"billing_profile",
"NGCP::Schema::Result::billing_profiles",
{ id => "billing_profile_id" },
{ cascade_copy => 0, cascade_delete => 0 },
);
sub TO_JSON {
my ($self) = @_;
return {
map { blessed($_) && $_->isa('DateTime') ? $_->datetime : $_ } %{ $self->next::method }
};
}
1;