Merge pull request #5739 from betagouv/dev

2020-11-12-01
This commit is contained in:
Paul Chavard 2020-11-12 17:16:39 +01:00 committed by GitHub
commit e1857042e4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 10 deletions

View file

@ -78,7 +78,7 @@ module Types
end
def champs
Loaders::Association.for(object.class, :champs).load(object)
Loaders::Association.for(object.class, champs: [:type_de_champ]).load(object)
end
def annotations

View file

@ -2,14 +2,17 @@
#
# Table name: deleted_dossiers
#
# id :bigint not null, primary key
# deleted_at :datetime
# reason :string
# state :string
# created_at :datetime not null
# updated_at :datetime not null
# dossier_id :bigint
# procedure_id :bigint
# id :bigint not null, primary key
# deleted_at :datetime
# reason :string
# state :string
# created_at :datetime not null
# updated_at :datetime not null
# dossier_id :bigint
# groupe_instructeur_id :bigint
# procedure_id :bigint
# revision_id :bigint
# user_id :bigint
#
class DeletedDossier < ApplicationRecord
belongs_to :procedure, -> { with_discarded }, inverse_of: :deleted_dossiers, optional: false
@ -28,6 +31,9 @@ class DeletedDossier < ApplicationRecord
create!(
reason: reasons.fetch(reason),
dossier_id: dossier.id,
groupe_instructeur_id: dossier.groupe_instructeur_id,
revision_id: dossier.revision_id,
user_id: dossier.user_id,
procedure: dossier.procedure,
state: dossier.state,
deleted_at: Time.zone.now

View file

@ -0,0 +1,7 @@
class AddRelationsToDeletedDossiers < ActiveRecord::Migration[6.0]
def change
add_column :deleted_dossiers, :user_id, :bigint
add_column :deleted_dossiers, :groupe_instructeur_id, :bigint
add_column :deleted_dossiers, :revision_id, :bigint
end
end

View file

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2020_11_05_131443) do
ActiveRecord::Schema.define(version: 2020_11_10_155516) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -196,6 +196,9 @@ ActiveRecord::Schema.define(version: 2020_11_05_131443) do
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "reason"
t.bigint "user_id"
t.bigint "groupe_instructeur_id"
t.bigint "revision_id"
t.index ["procedure_id"], name: "index_deleted_dossiers_on_procedure_id"
end