Skip to content

Commit

Permalink
[CPDLP-3843] Address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
leandroalemao committed Dec 20, 2024
1 parent c5d6e06 commit 10442a2
Show file tree
Hide file tree
Showing 14 changed files with 37 additions and 12 deletions.
2 changes: 1 addition & 1 deletion app/controllers/api/v1/ecf_participants_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
module Api
module V1
class ECFParticipantsController < Api::ApiController
include ApiTokenAuthenticatable
include LeadProviderApiTokenAuthenticatable
include ApiPagination
include ApiCsv
include ApiFilter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Api
module V1
class ParticipantDeclarationsController < Api::ApiController
include ApiAuditable
include ApiTokenAuthenticatable
include LeadProviderApiTokenAuthenticatable
include ApiPagination
include ApiCsv
include ApiFilter
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api/v1/participants_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
module Api
module V1
class ParticipantsController < Api::ApiController
include ApiTokenAuthenticatable
include LeadProviderApiTokenAuthenticatable
include ParticipantActions
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api/v3/delivery_partners_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module Api
module V3
class DeliveryPartnersController < Api::ApiController
include ApiTokenAuthenticatable
include LeadProviderApiTokenAuthenticatable
include ApiPagination
include ApiFilterValidation

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api/v3/ecf/partnerships_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Api
module V3
module ECF
class PartnershipsController < Api::ApiController
include ApiTokenAuthenticatable
include LeadProviderApiTokenAuthenticatable
include ApiPagination
include ApiFilterValidation

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api/v3/ecf/schools_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Api
module V3
module ECF
class SchoolsController < Api::ApiController
include ApiTokenAuthenticatable
include LeadProviderApiTokenAuthenticatable
include ApiPagination
include ApiFilterValidation

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api/v3/ecf/transfers_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Api
module V3
module ECF
class TransfersController < Api::ApiController
include ApiTokenAuthenticatable
include LeadProviderApiTokenAuthenticatable
include ApiPagination
include ApiFilterValidation

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api/v3/ecf/unfunded_mentors_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Api
module V3
module ECF
class UnfundedMentorsController < Api::ApiController
include ApiTokenAuthenticatable
include LeadProviderApiTokenAuthenticatable
include ApiPagination
include ApiFilterValidation

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api/v3/finance/statements_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module Api
module V3
class Finance::StatementsController < Api::ApiController
include ApiTokenAuthenticatable
include LeadProviderApiTokenAuthenticatable
include ApiPagination
include ApiFilterValidation

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Api
module V3
class ParticipantDeclarationsController < Api::ApiController
include ApiAuditable
include ApiTokenAuthenticatable
include LeadProviderApiTokenAuthenticatable
include ApiPagination
include ApiFilterValidation

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/concerns/api_token_authenticatable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@ def check_access_scope
end

def access_scope
LeadProviderApiToken.joins(cpd_lead_provider: [:lead_provider])
ApiToken.all
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# frozen_string_literal: true

module LeadProviderApiTokenAuthenticatable
extend ActiveSupport::Concern
include ApiTokenAuthenticatable

private

def access_scope
LeadProviderApiToken.joins(cpd_lead_provider: [:lead_provider])
end
end
13 changes: 13 additions & 0 deletions app/models/npq_registration_api_token.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

class NPQRegistrationApiToken < ApiToken
attribute :private_api_access, default: true

def owner
"npq_registration_application"
end

def owner_description
"NPQ registration application"
end
end
2 changes: 1 addition & 1 deletion spec/docs/v3/statements_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require "swagger_helper"

RSpec.describe "API", type: :request, swagger_doc: "v3/api_spec.json" do
let(:cpd_lead_provider) { create(:cpd_lead_provider) }
let(:cpd_lead_provider) { create(:cpd_lead_provider, :with_lead_provider) }
let(:token) { LeadProviderApiToken.create_with_random_token!(cpd_lead_provider:) }
let(:bearer_token) { "Bearer #{token}" }
let(:Authorization) { bearer_token }
Expand Down

0 comments on commit 10442a2

Please sign in to comment.