diff options
author | Dave Arter <davea@mysociety.org> | 2016-09-06 15:37:42 +0100 |
---|---|---|
committer | Dave Arter <davea@mysociety.org> | 2016-09-09 14:14:37 +0100 |
commit | 54a2b63fac54d01914fd2bb456da483e6982ee21 (patch) | |
tree | 574fe83a0dcf2cba219d32f440f44cde1dbc3132 /perllib/FixMyStreet/DB/Result/Contact.pm | |
parent | f8f870be0f9f648b48896cb6411446b7f9e049ce (diff) |
Refactor problem response priority into its own model
This moves the response priority values from a cobrand-specific method to a full
DB model, and includes management screens in the admin for administering them.
For mysociety/fixmystreetforcouncils#66
Diffstat (limited to 'perllib/FixMyStreet/DB/Result/Contact.pm')
-rw-r--r-- | perllib/FixMyStreet/DB/Result/Contact.pm | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/perllib/FixMyStreet/DB/Result/Contact.pm b/perllib/FixMyStreet/DB/Result/Contact.pm index ea9b656aa..b37734e7a 100644 --- a/perllib/FixMyStreet/DB/Result/Contact.pm +++ b/perllib/FixMyStreet/DB/Result/Contact.pm @@ -11,29 +11,29 @@ use base 'DBIx::Class::Core'; __PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn"); __PACKAGE__->table("contacts"); __PACKAGE__->add_columns( - "id", - { - data_type => "integer", - is_auto_increment => 1, - is_nullable => 0, - sequence => "contacts_id_seq", - }, "body_id", { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, - "category", - { data_type => "text", default_value => "Other", is_nullable => 0 }, "email", { data_type => "text", is_nullable => 0 }, - "confirmed", - { data_type => "boolean", is_nullable => 0 }, - "deleted", - { data_type => "boolean", is_nullable => 0 }, "editor", { data_type => "text", is_nullable => 0 }, "whenedited", { data_type => "timestamp", is_nullable => 0 }, "note", { data_type => "text", is_nullable => 0 }, + "confirmed", + { data_type => "boolean", is_nullable => 0 }, + "category", + { data_type => "text", default_value => "Other", is_nullable => 0 }, + "deleted", + { data_type => "boolean", is_nullable => 0 }, + "id", + { + data_type => "integer", + is_auto_increment => 1, + is_nullable => 0, + sequence => "contacts_id_seq", + }, "extra", { data_type => "text", is_nullable => 1 }, "non_public", @@ -56,6 +56,12 @@ __PACKAGE__->belongs_to( { is_deferrable => 0, on_delete => "NO ACTION", on_update => "NO ACTION" }, ); __PACKAGE__->has_many( + "contact_response_priorities", + "FixMyStreet::DB::Result::ContactResponsePriority", + { "foreign.contact_id" => "self.id" }, + { cascade_copy => 0, cascade_delete => 0 }, +); +__PACKAGE__->has_many( "contact_response_templates", "FixMyStreet::DB::Result::ContactResponseTemplate", { "foreign.contact_id" => "self.id" }, @@ -63,8 +69,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07035 @ 2016-08-24 11:29:04 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:CXUabm3Yd11OoIYJceSPag +# Created by DBIx::Class::Schema::Loader v0.07035 @ 2016-09-06 15:33:04 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ocmQGeFJtO3wmvyx6W+EKQ __PACKAGE__->load_components("+FixMyStreet::DB::RABXColumn"); __PACKAGE__->rabx_column('extra'); @@ -75,6 +81,7 @@ use namespace::clean -except => [ 'meta' ]; with 'FixMyStreet::Roles::Extra'; __PACKAGE__->many_to_many( response_templates => 'contact_response_templates', 'response_template' ); +__PACKAGE__->many_to_many( response_priorities => 'contact_response_priorities', 'response_priority' ); sub get_metadata_for_input { my $self = shift; |