Codeminer42/cm42-central

View on GitHub
app/operations/team_operations/unarchive.rb

Summary

Maintainability
A
0 mins
Test Coverage
module TeamOperations
  class Unarchive
    include Operation

    def initialize(team:)
      @team = team
    end

    def call
      ActiveRecord::Base.transaction do
        yield unarchive_team

        Success(team)
      end
    rescue
      Failure(team)
    end

    private

    attr_reader :team

    def unarchive_team
      Success(team.update(archived_at: nil))
    end
  end
end