Sha256: 989a51cf9b6456ae39909ccf125a3c7a57d8f534e9fbd06fe54d2afa17dc83df

Contents?: true

Size: 767 Bytes

Versions: 1

Compression:

Stored size: 767 Bytes

Contents

# frozen_string_literal: true

class Core::UseCases::<%= [@route_scope_class, @scope_class, @use_case_class].reject { |c| c.empty? }.join("::") %> < RiderKick::UseCases::AbstractUseCase
  contract do
    params(Core::UseCases::Contract::Default.new.call) do
<% @contract_fetch_by_id.each do |field| -%>
<% next if field.include?(":#{@resource_owner_id}") -%>
      <%= field %>
<% end -%>
<% if @resource_owner_id.present? -%>
      required(:<%= @resource_owner_id %>).filled(:string)
<% end -%>
    end
  end
  # Set specific return monads at method 'result'
  include Dry::Monads::Do.for(:result)

  def result
    params = yield build_parameter!
    Core::Repositories::<%= @scope_class%>::<%= @repository_class%>.new(params: params).call(builder: true)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rider-kick-0.0.6 lib/generators/rider_kick/templates/domains/core/use_cases/fetch_by_id.rb.tt