2021-02-01 19:09:14 -05:00
|
|
|
# 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
|
|
|
|
|
2021-09-22 08:12:04 -04:00
|
|
|
belongs_to :group, -> { where(type: Group.sti_name) }, foreign_key: 'namespace_id'
|
2021-02-01 19:09:14 -05:00
|
|
|
belongs_to :namespace
|
|
|
|
|
|
|
|
validates :namespace, presence: true
|
|
|
|
|
|
|
|
scope :with_namespace, ->(namespace) { where(namespace: namespace) }
|
|
|
|
scope :with_sha, ->(sha) { where(file_sha256: sha) }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|