Sha256: 727a3e0ea5562538baa554cc79f99de5798c39c495bdebe394a9c46500fb7dcb

Contents?: true

Size: 560 Bytes

Versions: 8

Compression:

Stored size: 560 Bytes

Contents

require_relative 'methods'

class Team
  include Mongoid::Document
  include Mongoid::Timestamps

  field :team_id, type: String
  field :name, type: String
  field :domain, type: String
  field :token, type: String
  field :active, type: Boolean, default: true

  include Methods

  def self.purge!
    # destroy teams inactive for two weeks
    Team.where(active: false, :updated_at.lte => 2.weeks.ago).each do |team|
      Mongoid.logger.info "Destroying #{team}, inactive since #{team.updated_at}, over two weeks ago."
      team.destroy
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
slack-ruby-bot-server-0.9.0 lib/slack-ruby-bot-server/models/team/mongoid.rb
slack-ruby-bot-server-0.8.3 lib/slack-ruby-bot-server/models/team/mongoid.rb
slack-ruby-bot-server-0.8.2 lib/slack-ruby-bot-server/models/team/mongoid.rb
slack-ruby-bot-server-0.8.1 lib/slack-ruby-bot-server/models/team/mongoid.rb
slack-ruby-bot-server-0.8.0 lib/slack-ruby-bot-server/models/team/mongoid.rb
slack-ruby-bot-server-0.7.0 lib/slack-ruby-bot-server/models/team/mongoid.rb
slack-ruby-bot-server-0.6.1 lib/slack-ruby-bot-server/models/team/mongoid.rb
slack-ruby-bot-server-0.6.0 lib/slack-ruby-bot-server/models/team/mongoid.rb