summaryrefslogtreecommitdiff
path: root/app/serializers/label_entity.rb
blob: 5082245dda9c3a9e8fc7f9f0cd6be6c3ddd9639c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# frozen_string_literal: true

class LabelEntity < Grape::Entity
  expose :id, if: ->(label, _) { !label.is_a?(GlobalLabel) }

  expose :title
  expose :color
  expose :description
  expose :group_id
  expose :project_id
  expose :template
  expose :text_color
  expose :created_at
  expose :updated_at

  expose :priority, if: -> (*) { options.key?(:project) } do |label|
    label.priority(options[:project])
  end
end