Files
MatchLiveTv/backend/app/services/tournaments/revoke_assignment.rb
T

21 lines
485 B
Ruby

module Tournaments
class RevokeAssignment
def self.call(assignment:)
new(assignment).call
end
def initialize(assignment)
@assignment = assignment
end
def call
invitation = @assignment.invitation
@assignment.destroy!
return unless invitation
leftover = invitation.assignments.reload.pluck(:match_id).map(&:to_s)
invitation.update!(scope_kind: "matches", match_ids: leftover, court: nil, on_date: nil)
end
end
end