Add support for FASP data sharing (#34415)
This commit is contained in:
parent
3ea1f074ab
commit
a5a2c6dc7e
38 changed files with 1140 additions and 1 deletions
|
@ -0,0 +1,26 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class Api::Fasp::DataSharing::V0::BackfillRequestsController < Api::Fasp::BaseController
|
||||
def create
|
||||
backfill_request = current_provider.fasp_backfill_requests.new(backfill_request_params)
|
||||
|
||||
respond_to do |format|
|
||||
format.json do
|
||||
if backfill_request.save
|
||||
render json: { backfillRequest: { id: backfill_request.id } }, status: 201
|
||||
else
|
||||
head 422
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def backfill_request_params
|
||||
params
|
||||
.permit(:category, :maxCount)
|
||||
.to_unsafe_h
|
||||
.transform_keys { |k| k.to_s.underscore }
|
||||
end
|
||||
end
|
|
@ -0,0 +1,10 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class Api::Fasp::DataSharing::V0::ContinuationsController < Api::Fasp::BaseController
|
||||
def create
|
||||
backfill_request = current_provider.fasp_backfill_requests.find(params[:backfill_request_id])
|
||||
Fasp::BackfillWorker.perform_async(backfill_request.id)
|
||||
|
||||
head 204
|
||||
end
|
||||
end
|
|
@ -0,0 +1,25 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class Api::Fasp::DataSharing::V0::EventSubscriptionsController < Api::Fasp::BaseController
|
||||
def create
|
||||
subscription = current_provider.fasp_subscriptions.create!(subscription_params)
|
||||
|
||||
render json: { subscription: { id: subscription.id } }, status: 201
|
||||
end
|
||||
|
||||
def destroy
|
||||
subscription = current_provider.fasp_subscriptions.find(params[:id])
|
||||
subscription.destroy
|
||||
|
||||
head 204
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def subscription_params
|
||||
params
|
||||
.permit(:category, :subscriptionType, :maxBatchSize, threshold: {})
|
||||
.to_unsafe_h
|
||||
.transform_keys { |k| k.to_s.underscore }
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue