diff options
Diffstat (limited to 'app/presenters/ml')
-rw-r--r-- | app/presenters/ml/models_index_presenter.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/app/presenters/ml/models_index_presenter.rb b/app/presenters/ml/models_index_presenter.rb new file mode 100644 index 00000000000..e2cb8e2d6c1 --- /dev/null +++ b/app/presenters/ml/models_index_presenter.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module Ml + class ModelsIndexPresenter + def initialize(models) + @models = models + end + + def present + data = @models.map do |m| + { + name: m.name, + version: m.version, + path: Gitlab::Routing.url_helpers.project_package_path(m.project, m) + } + end + + Gitlab::Json.generate({ models: data }) + end + end +end |