agranig/subprof
parent
d0de41effb
commit
aa621305b7
@ -0,0 +1,155 @@
|
|||||||
|
package NGCP::Schema::Result::invoice_template;
|
||||||
|
use Scalar::Util qw(blessed);
|
||||||
|
use parent 'DBIx::Class::Core';
|
||||||
|
|
||||||
|
our $VERSION = '2.009';
|
||||||
|
|
||||||
|
__PACKAGE__->load_components("InflateColumn::DateTime", "Helper::Row::ToJSON");
|
||||||
|
|
||||||
|
|
||||||
|
__PACKAGE__->table("billing.invoice_template");
|
||||||
|
|
||||||
|
|
||||||
|
__PACKAGE__->add_columns(
|
||||||
|
"id",
|
||||||
|
{
|
||||||
|
data_type => "integer",
|
||||||
|
extra => { unsigned => 1 },
|
||||||
|
is_auto_increment => 1,
|
||||||
|
is_nullable => 0,
|
||||||
|
},
|
||||||
|
"reseller_id",
|
||||||
|
{
|
||||||
|
data_type => "integer",
|
||||||
|
extra => { unsigned => 1 },
|
||||||
|
is_foreign_key => 1,
|
||||||
|
is_nullable => 0,
|
||||||
|
},
|
||||||
|
"type",
|
||||||
|
{
|
||||||
|
data_type => "enum",
|
||||||
|
default_value => "svg",
|
||||||
|
extra => { list => ["svg", "html"] },
|
||||||
|
is_nullable => 0,
|
||||||
|
},
|
||||||
|
"is_active",
|
||||||
|
{ data_type => "tinyint", default_value => 0, is_nullable => 0 },
|
||||||
|
"base64_saved",
|
||||||
|
{ data_type => "mediumblob", is_nullable => 1 },
|
||||||
|
"base64_previewed",
|
||||||
|
{ data_type => "mediumblob", is_nullable => 1 },
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
__PACKAGE__->set_primary_key("id");
|
||||||
|
|
||||||
|
|
||||||
|
__PACKAGE__->add_unique_constraint(
|
||||||
|
"invoice_template_reseller_active_UNIQUE",
|
||||||
|
["reseller_id", "is_active"],
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
__PACKAGE__->belongs_to(
|
||||||
|
"reseller",
|
||||||
|
"NGCP::Schema::Result::contacts",
|
||||||
|
{ id => "reseller_id" },
|
||||||
|
{ is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
|
||||||
|
);
|
||||||
|
sub TO_JSON {
|
||||||
|
my ($self) = @_;
|
||||||
|
return {
|
||||||
|
map { blessed($_) && $_->isa('DateTime') ? $_->datetime : $_ } %{ $self->next::method }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
=encoding UTF-8
|
||||||
|
|
||||||
|
=head1 NAME
|
||||||
|
|
||||||
|
NGCP::Schema::Result::invoice_template
|
||||||
|
|
||||||
|
=head1 COMPONENTS LOADED
|
||||||
|
|
||||||
|
=over 4
|
||||||
|
|
||||||
|
=item * L<DBIx::Class::InflateColumn::DateTime>
|
||||||
|
|
||||||
|
=item * L<DBIx::Class::Helper::Row::ToJSON>
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
=head1 TABLE: C<invoice_template>
|
||||||
|
|
||||||
|
=head1 ACCESSORS
|
||||||
|
|
||||||
|
=head2 id
|
||||||
|
|
||||||
|
data_type: 'integer'
|
||||||
|
extra: {unsigned => 1}
|
||||||
|
is_auto_increment: 1
|
||||||
|
is_nullable: 0
|
||||||
|
|
||||||
|
=head2 reseller_id
|
||||||
|
|
||||||
|
data_type: 'integer'
|
||||||
|
extra: {unsigned => 1}
|
||||||
|
is_foreign_key: 1
|
||||||
|
is_nullable: 0
|
||||||
|
|
||||||
|
=head2 type
|
||||||
|
|
||||||
|
data_type: 'enum'
|
||||||
|
default_value: 'svg'
|
||||||
|
extra: {list => ["svg","html"]}
|
||||||
|
is_nullable: 0
|
||||||
|
|
||||||
|
=head2 is_active
|
||||||
|
|
||||||
|
data_type: 'tinyint'
|
||||||
|
default_value: 0
|
||||||
|
is_nullable: 0
|
||||||
|
|
||||||
|
=head2 base64_saved
|
||||||
|
|
||||||
|
data_type: 'mediumblob'
|
||||||
|
is_nullable: 1
|
||||||
|
|
||||||
|
=head2 base64_previewed
|
||||||
|
|
||||||
|
data_type: 'mediumblob'
|
||||||
|
is_nullable: 1
|
||||||
|
|
||||||
|
=head1 PRIMARY KEY
|
||||||
|
|
||||||
|
=over 4
|
||||||
|
|
||||||
|
=item * L</id>
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
=head1 UNIQUE CONSTRAINTS
|
||||||
|
|
||||||
|
=head2 C<invoice_template_reseller_active_UNIQUE>
|
||||||
|
|
||||||
|
=over 4
|
||||||
|
|
||||||
|
=item * L</reseller_id>
|
||||||
|
|
||||||
|
=item * L</is_active>
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
=head1 RELATIONS
|
||||||
|
|
||||||
|
=head2 reseller
|
||||||
|
|
||||||
|
Type: belongs_to
|
||||||
|
|
||||||
|
Related object: L<NGCP::Schema::Result::contacts>
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
|
||||||
|
# You can replace this text with custom code or comments, and it will be preserved on regeneration
|
||||||
|
__PACKAGE__->meta->make_immutable;
|
||||||
|
1;
|
Loading…
Reference in new issue