Skip to content

Commit

Permalink
feat: Increase metadata max value length (#2952)
Browse files Browse the repository at this point in the history
## Context

increased customer and wallet transactions metadata value size limit to
100
  • Loading branch information
brunomiguelpinto authored Dec 12, 2024
1 parent 8f7efb2 commit a9b0766
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/models/metadata/customer_metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class CustomerMetadata < ApplicationRecord
belongs_to :customer

validates :key, presence: true, uniqueness: {scope: :customer_id}, length: {maximum: 20}
validates :value, presence: true, length: {maximum: 40}
validates :value, presence: true, length: {maximum: 100}

scope :displayable, -> { where(display_in_invoice: true) }
end
Expand Down
2 changes: 1 addition & 1 deletion app/services/validators/metadata_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class MetadataValidator
DEFAULT_CONFIG = {
max_keys: 5,
max_key_length: 20,
max_value_length: 40
max_value_length: 100
}.freeze

attr_reader :metadata, :errors, :config
Expand Down
4 changes: 2 additions & 2 deletions spec/models/metadata/customer_metadata_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@
end

context 'when value length is invalid' do
let(:value) { 'abcde-abcde-abcde-abcde-abcde-abcde' }
let(:value) { 'a' * 101 }

it { expect(metadata).to be_valid }
it { expect(metadata).not_to be_valid }
end
end
end

0 comments on commit a9b0766

Please sign in to comment.