Retrospring/lib/use_case/reaction/destroy.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

26 lines
492 B
Ruby
Raw Normal View History

# frozen_string_literal: true
module UseCase
module Reaction
class Destroy < UseCase::Base
option :source_user_id, type: Types::Coercible::Integer
option :target, type: Types.Instance(::Answer) | Types.Instance(::Comment)
def call
source_user.unsmile target
{
status: 204,
resource: nil,
}
end
private
def source_user
@source_user ||= ::User.find(source_user_id)
end
end
end
end