db(migration): add closing_reason and closing_details to procedure

This commit is contained in:
Eric Leroy-Terquem 2024-02-15 10:41:58 +01:00
parent 3b13595a41
commit 6651b36fe4
3 changed files with 28 additions and 0 deletions

View file

@ -223,6 +223,11 @@ class Procedure < ApplicationRecord
accepte: 'accepte'
}
enum closing_reason: {
internal_procedure: 'internal_procedure',
other: 'other'
}
scope :for_api_v2, -> {
includes(:draft_revision, :published_revision, administrateurs: :user)
}
@ -260,6 +265,9 @@ class Procedure < ApplicationRecord
validate :check_juridique, on: [:create, :publication]
# TO DO add validation after data backfill
# validates :replaced_by_id, presence: true, if: -> { closing_reason == self.closing_reasons.fetch(:internal_procedure) }
validates :path, presence: true, format: { with: /\A[a-z0-9_\-]{3,200}\z/ }, uniqueness: { scope: [:path, :closed_at, :hidden_at, :unpublished_at], case_sensitive: false }
validates :duree_conservation_dossiers_dans_ds, allow_nil: false,
numericality: {