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

class LabelEntity < Grape::Entity
  expose :id

  expose :title
  expose :color do |label|
    label.color.to_s
  end
  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