mirror of
https://github.com/Retrospring/retrospring.git
synced 2025-03-31 12:12:12 +02:00
this also allows the UseCase classes to be hot reloaded in dev 🎉
- remove use_case requires (except for the exporter as Zeitwerk
doesn't know about the subclasses)
- move version.rb to lib/retrospring so that Zeitwerk knows where
to find Retrospring::Version
25 lines
527 B
Ruby
25 lines
527 B
Ruby
# frozen_string_literal: true
|
|
|
|
require "errors"
|
|
|
|
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)
|
|
|
|
{
|
|
status: 204,
|
|
resource: nil,
|
|
extra: {
|
|
target_user: target_user
|
|
}
|
|
}
|
|
end
|
|
end
|
|
end
|
|
end
|