Sha256: 98342c757219267a82573c39f16a6c109db68fd1556b105202e5df599dbcada4

Contents?: true

Size: 661 Bytes

Versions: 2

Compression:

Stored size: 661 Bytes

Contents

# frozen_string_literal: true

class Core::Repositories::<%= @scope_class %>::<%= @repository_class %> < Core::Repositories::AbstractRepository
  def initialize(params:)
    @id  = params.id
  end

  def call(builder: true)
<% if @resource_owner_id.present? -%>
    resource = <%= @model_class %>.find_by(id: @id, <%=@resource_owner_id%>: @params.<%=@resource_owner_id%>)
<% else -%>
    resource = <%= @model_class %>.find_by(id: @id)
<% end -%>
    return Failure '<%= @subject_class %> not found' unless resource.present?
    unless resource.destroy
      return Failure build_errors(resource)
    end
    Success '<%= @subject_class%> Destroyed.'
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rider-kick-0.0.7 lib/generators/rider_kick/templates/domains/core/repositories/destroy.rb.tt
rider-kick-0.0.6 lib/generators/rider_kick/templates/domains/core/repositories/destroy.rb.tt