diff --git a/app/graphql/types/dossier_type.rb b/app/graphql/types/dossier_type.rb index 341ae242c..55e8716f4 100644 --- a/app/graphql/types/dossier_type.rb +++ b/app/graphql/types/dossier_type.rb @@ -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 diff --git a/app/models/deleted_dossier.rb b/app/models/deleted_dossier.rb index 5418b370d..98f69d8a2 100644 --- a/app/models/deleted_dossier.rb +++ b/app/models/deleted_dossier.rb @@ -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 diff --git a/db/migrate/20201110155516_add_relations_to_deleted_dossiers.rb b/db/migrate/20201110155516_add_relations_to_deleted_dossiers.rb new file mode 100644 index 000000000..b1fd6ba76 --- /dev/null +++ b/db/migrate/20201110155516_add_relations_to_deleted_dossiers.rb @@ -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 diff --git a/db/schema.rb b/db/schema.rb index 446e907dc..1d51fe378 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -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