diff options
Diffstat (limited to 'app/models/projects/data_transfer.rb')
-rw-r--r-- | app/models/projects/data_transfer.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/app/models/projects/data_transfer.rb b/app/models/projects/data_transfer.rb new file mode 100644 index 00000000000..a93aea55781 --- /dev/null +++ b/app/models/projects/data_transfer.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +# Tracks egress of various services per project +# This class ensures that we keep 1 record per project per month. +module Projects + class DataTransfer < ApplicationRecord + self.table_name = 'project_data_transfers' + + belongs_to :project + belongs_to :namespace + + scope :current_month, -> { where(date: beginning_of_month) } + + def self.beginning_of_month(time = Time.current) + time.utc.beginning_of_month + end + end +end |