mirror of
https://github.com/Retrospring/retrospring.git
synced 2025-02-12 14:23:36 +01:00
21 lines
468 B
Ruby
21 lines
468 B
Ruby
|
# frozen_string_literal: true
|
||
|
|
||
|
module UseCase
|
||
|
module Reaction
|
||
|
class Create < UseCase::Base
|
||
|
option :source_user, type: Types.Instance(::User)
|
||
|
option :target, type: Types.Instance(::Answer) | Types.Instance(::Comment)
|
||
|
option :content, type: Types::Coercible::String, optional: true
|
||
|
|
||
|
def call
|
||
|
reaction = source_user.smile target
|
||
|
|
||
|
{
|
||
|
status: 201,
|
||
|
resource: reaction,
|
||
|
}
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|