Skip to content

Commit

Permalink
apply Amines suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
Holist committed Jan 29, 2025
1 parent 2b49452 commit 39ceb8e
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .env.test
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ FRANCE_TRAVAIL_AUTH_URL=https://somefakeauthurl.fr
FRANCE_TRAVAIL_API_URL=https://francetravailfakerdvurl.fr
FRANCE_TRAVAIL_CLIENT_ID=client_id
FRANCE_TRAVAIL_CLIENT_SECRET=client_secret
FRANCE_TRAVAIL_CD_NUMBER=83
FRANCE_TRAVAIL_WEBHOOKS_DEPARTMENTS=83

AGENT_SIGNATURE_KEY=bc995863-5c80-43a3-a31d-0da216e814a4
HOST=http://www.rdv-insertion-test.fake
17 changes: 17 additions & 0 deletions app/jobs/outgoing_webhooks/france_travail/base_job.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module OutgoingWebhooks
module FranceTravail
class BaseJob < ApplicationJob
include LockedAndOrderedJobs

discard_on FranceTravailApi::RetrieveUserToken::UserNotFound

def self.lock_key(participation_id:, **)
"#{base_lock_key}:#{participation_id}"
end

def self.job_timestamp(timestamp:, **)
timestamp
end
end
end
end
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
module OutgoingWebhooks
module FranceTravail
class CreateParticipationJob < LockedAndOrderedJobBase
discard_on FranceTravailApi::RetrieveUserToken::UserNotFound

def self.lock_key(participation_id:, **)
"#{base_lock_key}:#{participation_id}"
end

class CreateParticipationJob < BaseJob
def perform(participation_id:, timestamp:)
call_service!(FranceTravailApi::CreateParticipation, participation_id: participation_id, timestamp: timestamp)
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
module OutgoingWebhooks
module FranceTravail
class DeleteParticipationJob < LockedAndOrderedJobBase
discard_on FranceTravailApi::RetrieveUserToken::UserNotFound

def self.lock_key(participation_id:, **)
"#{base_lock_key}:#{participation_id}"
end

class DeleteParticipationJob < BaseJob
def perform(participation_id:, france_travail_id:, user_id:, timestamp:)
call_service!(FranceTravailApi::DeleteParticipation,
participation_id: participation_id,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
module OutgoingWebhooks
module FranceTravail
class UpdateParticipationJob < LockedAndOrderedJobBase
discard_on FranceTravailApi::RetrieveUserToken::UserNotFound

def self.lock_key(participation_id:, **)
"#{base_lock_key}:#{participation_id}"
end

class UpdateParticipationJob < BaseJob
def perform(participation_id:, timestamp:)
call_service!(FranceTravailApi::UpdateParticipation, participation_id: participation_id, timestamp: timestamp)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ def eligible_for_france_travail_webhook_update?
def france_travail_active_department?
# C'est une condition temporaire, les autorisations des clés d'api de France Travail sont scopés au niveau des CD
# le temps que FT autorise notre clé d'API au niveau national on limitera à un département pour les tests
organisation.department.number == ENV["FRANCE_TRAVAIL_CD_NUMBER"]
organisation.department.number.in?(ENV.fetch("FRANCE_TRAVAIL_WEBHOOKS_DEPARTMENTS", "").split(","))
end
end

0 comments on commit 39ceb8e

Please sign in to comment.