summaryrefslogtreecommitdiff
path: root/lib/api/entities/project_service.rb
blob: 947cec1e3cd199c52f190ae4691a851970778568 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# frozen_string_literal: true

module API
  module Entities
    class ProjectService < Entities::ProjectServiceBasic
      # Expose serialized properties
      expose :properties do |service, options|
        # TODO: Simplify as part of https://gitlab.com/gitlab-org/gitlab/issues/29404
        if service.data_fields_present?
          service.data_fields.as_json.slice(*service.api_field_names)
        else
          service.properties.slice(*service.api_field_names)
        end
      end
    end
  end
end