chore(schema): create dossier_corrections

This commit is contained in:
Colin Darie 2023-02-28 15:06:39 +01:00
parent 5d245fee7d
commit 2c79ca94f5
No known key found for this signature in database
GPG key ID: 4FB865FDBCA4BCC4
8 changed files with 68 additions and 0 deletions

View file

@ -19,6 +19,7 @@ class Commentaire < ApplicationRecord
belongs_to :instructeur, inverse_of: :commentaires, optional: true
belongs_to :expert, inverse_of: :commentaires, optional: true
has_one :dossier_resolution, inverse_of: :commentaire, dependent: :nullify
validate :messagerie_available?, on: :create, unless: -> { dossier.brouillon? }

View file

@ -0,0 +1,7 @@
module DossierResolvableConcern
extend ActiveSupport::Concern
included do
has_many :resolutions, class_name: 'DossierResolution', dependent: :destroy
end
end

View file

@ -50,6 +50,7 @@ class Dossier < ApplicationRecord
include DossierFilteringConcern
include DossierPrefillableConcern
include DossierRebaseConcern
include DossierResolvableConcern
include DossierSearchableConcern
include DossierSectionsConcern
include DossierCloneConcern

View file

@ -0,0 +1,15 @@
# == Schema Information
#
# Table name: dossier_resolutions
#
# id :bigint not null, primary key
# resolved_at :datetime
# created_at :datetime not null
# updated_at :datetime not null
# commentaire_id :bigint
# dossier_id :bigint not null
#
class DossierResolution < ApplicationRecord
belongs_to :dossier
belongs_to :commentaire
end