summaryrefslogtreecommitdiff
path: root/app/models/ci/resource.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/ci/resource.rb')
-rw-r--r--app/models/ci/resource.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/app/models/ci/resource.rb b/app/models/ci/resource.rb
new file mode 100644
index 00000000000..ee5b6546165
--- /dev/null
+++ b/app/models/ci/resource.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+module Ci
+ class Resource < ApplicationRecord
+ extend Gitlab::Ci::Model
+
+ belongs_to :resource_group, class_name: 'Ci::ResourceGroup', inverse_of: :resources
+ belongs_to :build, class_name: 'Ci::Build', inverse_of: :resource
+
+ scope :free, -> { where(build: nil) }
+ scope :retained_by, -> (build) { where(build: build) }
+ end
+end