Sha256: 8f8e9bee0718e2e85bc4ff20400cab1343f9cb8300f25d4f53e2a413861b5119

Contents?: true

Size: 838 Bytes

Versions: 3

Compression:

Stored size: 838 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, Core::UseCases::Contract::Pagination.new.call) do
<% @contract_list.each do |field| -%>
<% next if field.include?("#{@resource_owner_id}") && @resource_owner_id.present? -%>
      <%= 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

3 entries across 3 versions & 1 rubygems

Version Path
rider-kick-0.0.10 lib/generators/rider_kick/templates/domains/core/use_cases/list.rb.tt
rider-kick-0.0.9 lib/generators/rider_kick/templates/domains/core/use_cases/list.rb.tt
rider-kick-0.0.8 lib/generators/rider_kick/templates/domains/core/use_cases/list.rb.tt