2020-05-08 20:09:39 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Ci
|
2021-08-03 02:08:50 -04:00
|
|
|
class FreezePeriod < Ci::ApplicationRecord
|
2020-05-08 20:09:39 -04:00
|
|
|
include StripAttribute
|
2021-08-03 02:08:50 -04:00
|
|
|
include Ci::NamespacedModelName
|
2020-05-08 20:09:39 -04:00
|
|
|
|
2020-06-10 08:08:58 -04:00
|
|
|
default_scope { order(created_at: :asc) } # rubocop:disable Cop/DefaultScope
|
2020-05-15 08:08:28 -04:00
|
|
|
|
2020-05-08 20:09:39 -04:00
|
|
|
belongs_to :project, inverse_of: :freeze_periods
|
|
|
|
|
2021-08-16 20:10:22 -04:00
|
|
|
strip_attributes! :freeze_start, :freeze_end
|
2020-05-08 20:09:39 -04:00
|
|
|
|
|
|
|
validates :freeze_start, cron: true, presence: true
|
|
|
|
validates :freeze_end, cron: true, presence: true
|
|
|
|
validates :cron_timezone, cron_freeze_period_timezone: true, presence: true
|
|
|
|
end
|
|
|
|
end
|