Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cache_file.rb « composer « packages « models « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ecd7596b989dd661a52a215edcf994a82a37a4ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# frozen_string_literal: true

module Packages
  module Composer
    class CacheFile < ApplicationRecord
      include FileStoreMounter

      self.table_name = 'packages_composer_cache_files'

      mount_file_store_uploader Packages::Composer::CacheUploader

      belongs_to :group, -> { where(type: 'Group') }, foreign_key: 'namespace_id'
      belongs_to :namespace

      validates :namespace, presence: true

      scope :with_namespace, ->(namespace) { where(namespace: namespace) }
      scope :with_sha, ->(sha) { where(file_sha256: sha) }
      scope :expired, -> { where("delete_at <= ?", Time.current) }
      scope :without_namespace, -> { where(namespace_id: nil) }
    end
  end
end