Skip to content

Commit

Permalink
no default value for client_type
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Jul 28, 2019
1 parent ac3af0a commit 5e488f0
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 5 deletions.
1 change: 1 addition & 0 deletions app/models/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion app/serializers/client_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/serializers/periodical_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/serializers/repository_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions db/migrate/20190727170040_add_client_fields.rb
Original file line number Diff line number Diff line change
@@ -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]
Expand Down

0 comments on commit 5e488f0

Please sign in to comment.