lib/ledger_sync/domains/operation/remove.rb in ledger_sync-domains-1.0.1 vs lib/ledger_sync/domains/operation/remove.rb in ledger_sync-domains-1.0.2

- old
+ new

@@ -5,10 +5,17 @@ module LedgerSync module Domains class Operation class Remove < Resource + class Contract < LedgerSync::Ledgers::Contract + params do + required(:id).filled(:integer) + required(:query).value(:hash) + end + end + private def operate return failure('Resource not found') unless resource @@ -21,10 +28,10 @@ ) end end def resource - @resource ||= resource_class.find_by(id: params[:id]) + @resource ||= resource_class.where(params[:query]).find_by(id: params[:id]) end def success super( true