debian-mirror-gitlab/app/models/ci/catalog/resource.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

29 lines
766 B
Ruby
Raw Normal View History

2023-05-27 22:25:52 +05:30
# frozen_string_literal: true
module Ci
module Catalog
# This class represents a CI/CD Catalog resource.
# A Catalog resource is normally associated to a project.
# This model connects to the `main` database because of its
# dependency on the Project model and its need to join with that table
# in order to generate the CI/CD catalog.
class Resource < ::ApplicationRecord
self.table_name = 'catalog_resources'
belongs_to :project
2023-06-20 00:43:36 +05:30
scope :for_projects, ->(project_ids) { where(project_id: project_ids) }
delegate :avatar_path, :description, :name, to: :project
def versions
project.releases.order_released_desc
end
def latest_version
versions.first
end
2023-05-27 22:25:52 +05:30
end
end
end