1# frozen_string_literal: true 2 3module API 4 module Entities 5 class Milestone < Grape::Entity 6 expose :id, :iid 7 expose :project_id, if: -> (entity, options) { entity&.project_id } 8 expose :group_id, if: -> (entity, options) { entity&.group_id } 9 expose :title, :description 10 expose :state, :created_at, :updated_at 11 expose :due_date 12 expose :start_date 13 expose :expired?, as: :expired 14 15 expose :web_url do |milestone, _options| 16 Gitlab::UrlBuilder.build(milestone) 17 end 18 end 19 end 20end 21