mirror of
https://github.com/Retrospring/retrospring.git
synced 2025-01-31 14:19:07 +01:00
cc7fa787e8
For some wild reason this locally sometimes causes coercion errors in the user instance check, restarting fixes it (temporarily?) so letting the UseCase resolve users is a cleaner solution here.
25 lines
492 B
Ruby
25 lines
492 B
Ruby
# 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
|