From 5affe56e9710ab045f03ac771967b83c6204634e Mon Sep 17 00:00:00 2001 From: Rene Krenn Date: Wed, 21 Jun 2017 03:44:44 +0200 Subject: [PATCH] TT#14755 call list suppressions Change-Id: I12e2480695a629f95433b1c34ba0bad0aa5f97e1 --- .../Schema/Result/call_list_suppressions.pm | 79 +++++++++++++++++++ lib/NGCP/Schema/Result/domains.pm | 7 ++ 2 files changed, 86 insertions(+) create mode 100644 lib/NGCP/Schema/Result/call_list_suppressions.pm diff --git a/lib/NGCP/Schema/Result/call_list_suppressions.pm b/lib/NGCP/Schema/Result/call_list_suppressions.pm new file mode 100644 index 00000000..b91550bb --- /dev/null +++ b/lib/NGCP/Schema/Result/call_list_suppressions.pm @@ -0,0 +1,79 @@ +package NGCP::Schema::Result::call_list_suppressions; +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.call_list_suppressions"); + +__PACKAGE__->add_columns( + "id", + { + data_type => "integer", + extra => { unsigned => 1 }, + is_auto_increment => 1, + is_nullable => 0, + }, + "domain", + { data_type => "varchar", + default_value => "", + is_nullable => 0, + size => 255, + }, + "pattern", + { data_type => "varchar", + default_value => ".", + is_nullable => 0, + size => 255, + }, + "label", + { data_type => "varchar", + default_value => "obfuscated", + is_nullable => 0, + size => 255, + }, + "direction", + { + data_type => "enum", + default_value => "outgoing", + extra => { list => ['outgoing','incoming'] }, + is_nullable => 0, + }, + "mode", + { + data_type => "enum", + default_value => "disabled", + extra => { list => ['disabled','filter','obfuscate'] }, + is_nullable => 0, + }, + +); + +__PACKAGE__->set_primary_key("id"); + +__PACKAGE__->add_unique_constraint("cls_domain_direction_pattern_idx", ["domain", "direction", "pattern"]); + +#__PACKAGE__->belongs_to( +# "domain", +# "NGCP::Schema::Result::domains", +# { id => "domain_id" }, +# { +# is_deferrable => 1, +# join_type => "LEFT", +# on_delete => "CASCADE", +# on_update => "CASCADE", +# }, +#); + +sub TO_JSON { + my ($self) = @_; + return { + map { blessed($_) && $_->isa('DateTime') ? $_->datetime : $_ } %{ $self->next::method } + }; +} + +1; + + diff --git a/lib/NGCP/Schema/Result/domains.pm b/lib/NGCP/Schema/Result/domains.pm index 491d812d..c081fc44 100644 --- a/lib/NGCP/Schema/Result/domains.pm +++ b/lib/NGCP/Schema/Result/domains.pm @@ -38,6 +38,13 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +#__PACKAGE__->has_many( +# "call_list_suppressions", +# "NGCP::Schema::Result::call_list_suppressions", +# { "foreign.domain_id" => "self.id" }, +# { cascade_copy => 0, cascade_delete => 0 }, +#); + __PACKAGE__->has_one( "provisioning_voip_domain", "NGCP::Schema::Result::voip_domains",