Class: SocMed::ReportsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/soc_med/reports_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



8
9
10
11
12
13
# File 'app/controllers/soc_med/reports_controller.rb', line 8

def create
  report_service::Create.call(params) do |success, failure|
    success.call { |object| success_response(report: serialized_resource(object, ::Reports::OverviewBlueprint)) }
    failure.call(&method(:error_response))
  end
end

#destroyObject



15
16
17
18
19
20
# File 'app/controllers/soc_med/reports_controller.rb', line 15

def destroy
  report_service::Destroy.call(params) do |success, failure|
    success.call { success_response(report: { destroyed: true }) }
    failure.call(&method(:error_response))
  end
end