Add graph loading scopes to Dossier and Procedure
This commit is contained in:
parent
7f09d0e430
commit
2e854f2ac3
2 changed files with 7 additions and 0 deletions
|
@ -163,6 +163,9 @@ class Dossier < ApplicationRecord
|
||||||
}
|
}
|
||||||
|
|
||||||
scope :for_procedure, -> (procedure) { includes(:user, :groupe_instructeur).where(groupe_instructeurs: { procedure: procedure }) }
|
scope :for_procedure, -> (procedure) { includes(:user, :groupe_instructeur).where(groupe_instructeurs: { procedure: procedure }) }
|
||||||
|
scope :for_api_v2, -> {
|
||||||
|
includes(procedure: [:administrateurs], etablissement: [], individual: [])
|
||||||
|
}
|
||||||
|
|
||||||
accepts_nested_attributes_for :individual
|
accepts_nested_attributes_for :individual
|
||||||
|
|
||||||
|
|
|
@ -62,6 +62,10 @@ class Procedure < ApplicationRecord
|
||||||
accepte: 'accepte'
|
accepte: 'accepte'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
scope :for_api_v2, -> {
|
||||||
|
includes(administrateurs: :user)
|
||||||
|
}
|
||||||
|
|
||||||
validates :libelle, presence: true, allow_blank: false, allow_nil: false
|
validates :libelle, presence: true, allow_blank: false, allow_nil: false
|
||||||
validates :description, presence: true, allow_blank: false, allow_nil: false
|
validates :description, presence: true, allow_blank: false, allow_nil: false
|
||||||
validates :administrateurs, presence: true
|
validates :administrateurs, presence: true
|
||||||
|
|
Loading…
Reference in a new issue