diff --git a/app/models/client.rb b/app/models/client.rb index c48a81e13..3e5550498 100644 --- a/app/models/client.rb +++ b/app/models/client.rb @@ -296,6 +296,7 @@ def user_url def set_defaults self.contact_name = "" unless contact_name.present? self.domains = "*" unless domains.present? + self.client_type = "repository" unless client_type.present? self.issn = [] if issn.blank? || client_type == "repository" self.certificate = [] if certificate.blank? || client_type == "periodical" self.is_active = is_active ? "\x01" : "\x00" diff --git a/app/serializers/client_serializer.rb b/app/serializers/client_serializer.rb index 9d56295e5..d9976c579 100644 --- a/app/serializers/client_serializer.rb +++ b/app/serializers/client_serializer.rb @@ -5,7 +5,7 @@ class ClientSerializer set_id :uid cache_options enabled: true, cache_length: 24.hours - attributes :name, :alternate_name, :symbol, :year, :contact_name, :contact_email, :description, :language, :client_type, :domains, :url, :created, :updated + attributes :name, :symbol, :year, :contact_name, :contact_email, :alternate_name, :description, :language, :client_type, :domains, :url, :created, :updated belongs_to :provider, record_type: :providers has_many :prefixes, record_type: :prefixes diff --git a/app/serializers/periodical_serializer.rb b/app/serializers/periodical_serializer.rb index 431b982f0..5fe5c9b92 100644 --- a/app/serializers/periodical_serializer.rb +++ b/app/serializers/periodical_serializer.rb @@ -4,7 +4,7 @@ class PeriodicalSerializer set_type :periodicals set_id :uid - attributes :name, :alternate_name, :symbol, :year, :contact_name, :contact_email, :description, :client_type, :language, :domains, :issn, :url, :created, :updated + attributes :name, :symbol, :year, :contact_name, :contact_email, :alternate_name, :description, :client_type, :language, :domains, :issn, :url, :created, :updated belongs_to :provider, record_type: :providers has_many :prefixes, record_type: :prefixes diff --git a/app/serializers/repository_serializer.rb b/app/serializers/repository_serializer.rb index 3b809eb38..723258714 100644 --- a/app/serializers/repository_serializer.rb +++ b/app/serializers/repository_serializer.rb @@ -4,7 +4,7 @@ class RepositorySerializer set_type :repositories set_id :uid - attributes :name, :alternate_name, :symbol, :re3data, :opendoar, :year, :contact_name, :contact_email, :description, :client_type, :language, :certificate, :domains, :url, :created, :updated + attributes :name, :symbol, :re3data, :opendoar, :year, :contact_name, :contact_email, :alternate_name, :description, :client_type, :language, :certificate, :domains, :url, :created, :updated belongs_to :provider, record_type: :providers has_many :prefixes, record_type: :prefixes diff --git a/db/migrate/20190727170040_add_client_fields.rb b/db/migrate/20190727170040_add_client_fields.rb index f447434c6..9eeaf00eb 100644 --- a/db/migrate/20190727170040_add_client_fields.rb +++ b/db/migrate/20190727170040_add_client_fields.rb @@ -1,7 +1,5 @@ class AddClientFields < ActiveRecord::Migration[5.2] def change - change_column_default :datacentre, :client_type, from: nil, to: "repository" - remove_index :datacentre, [:re3data] rename_column :datacentre, :re3data, :re3data_id add_index :datacentre, [:re3data_id]