2023-10-28 08:16:03 -07:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module UseCase
|
|
|
|
module Reaction
|
|
|
|
class Destroy < UseCase::Base
|
2024-03-19 14:06:57 -07:00
|
|
|
option :source_user_id, type: Types::Coercible::Integer
|
2023-10-28 08:16:03 -07:00
|
|
|
option :target, type: Types.Instance(::Answer) | Types.Instance(::Comment)
|
|
|
|
|
|
|
|
def call
|
|
|
|
source_user.unsmile target
|
|
|
|
|
|
|
|
{
|
|
|
|
status: 204,
|
|
|
|
resource: nil,
|
|
|
|
}
|
|
|
|
end
|
2024-03-19 14:06:57 -07:00
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def source_user
|
|
|
|
@source_user ||= ::User.find(source_user_id)
|
|
|
|
end
|
2023-10-28 08:16:03 -07:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|