Retrospring/lib/use_case/relationship/destroy.rb

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

24 lines
509 B
Ruby
Raw Normal View History

# frozen_string_literal: true
module UseCase
module Relationship
class Destroy < UseCase::Base
option :source_user, type: Types.Instance(::User)
option :target_user, type: Types.Instance(::User)
option :type, type: Types::RelationshipTypes
def call
source_user.public_send("un#{type}", target_user)
{
2022-01-16 09:51:27 -08:00
status: 204,
resource: nil,
2022-01-16 09:51:27 -08:00
extra: {
target_user: target_user
}
}
end
end
end
end