Skip to content

Commit

Permalink
dont refactor api particulier
Browse files Browse the repository at this point in the history
  • Loading branch information
JeSuisUnCaillou committed Nov 29, 2024
1 parent 3d9db79 commit 4184842
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
12 changes: 7 additions & 5 deletions app/models/authorization_request/api_particulier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@ class AuthorizationRequest::APIParticulier < AuthorizationRequest
include AuthorizationExtensions::BasicInfos
include AuthorizationExtensions::PersonalData
include AuthorizationExtensions::CadreJuridique
include AuthorizationExtensions::Modalities

MODALITIES = %w[params formulaire_qf].freeze

validate :modalities_in_available_values

add_document :maquette_projet, content_type: ['application/pdf'], size: { less_than: 10.megabytes }

add_attributes :date_prevue_mise_en_production,
:volumetrie_approximative

add_attribute :modalities,
type: :array,
validation: {
presence: true,
intersection: { in: %w[params formulaire_qf] },
}

add_scopes(validation: {
presence: true, if: -> { need_complete_validation?(:scopes) }
})
Expand Down
4 changes: 1 addition & 3 deletions app/models/concerns/authorization_extensions/modalities.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
module AuthorizationExtensions::Modalities
extend ActiveSupport::Concern
include AuthorizationCore::Attributes

included do
add_attributes :modalities, type: :array
add_attributes :modalities

validates :modalities,
presence: true,
Expand Down
2 changes: 1 addition & 1 deletion spec/models/authorization_request/api_particulier_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
context 'with values' do
let(:authorization_request) { create(:authorization_request, :api_particulier, modalities: %w[params formulaire_qf]) }

it { is_expected.to eq(%w[params formulaire_qf]) }
it { is_expected.to eq(%w[formulaire_qf params]) }
end
end

Expand Down

0 comments on commit 4184842

Please sign in to comment.