summaryrefslogtreecommitdiff
path: root/app/models/resource_timebox_event.rb
blob: 44f48915425746d94e3694bfd2c709f2942bfcfe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# frozen_string_literal: true

class ResourceTimeboxEvent < ResourceEvent
  self.abstract_class = true

  include IssueResourceEvent
  include MergeRequestResourceEvent

  validate :exactly_one_issuable

  enum action: {
    add: 1,
    remove: 2
  }

  def self.issuable_attrs
    %i(issue merge_request).freeze
  end

  def issuable
    issue || merge_request
  end
end