Delete the InviteGestionnaire model

This commit is contained in:
gregoirenovel 2018-10-10 09:06:32 +02:00
parent 7b4ab556b1
commit ed11852300
6 changed files with 8 additions and 12 deletions

View file

@ -25,7 +25,6 @@ class Dossier < ApplicationRecord
has_many :commentaires, dependent: :destroy
has_many :invites, dependent: :destroy
has_many :invites_user, class_name: 'InviteUser', dependent: :destroy
has_many :invites_gestionnaires, class_name: 'InviteGestionnaire', dependent: :destroy
has_many :follows
has_many :followers_gestionnaires, through: :follows, source: :gestionnaire
has_many :avis, dependent: :destroy

View file

@ -1,2 +0,0 @@
class InviteGestionnaire < Invite
end

View file

@ -10,8 +10,7 @@ class DossierSerializer < ActiveModel::Serializer
:received_at,
:processed_at,
:motivation,
:instructeurs,
:invites
:instructeurs
has_one :individual
has_one :entreprise
@ -62,10 +61,6 @@ class DossierSerializer < ActiveModel::Serializer
object.followers_gestionnaires.pluck(:email)
end
def invites
object.invites_gestionnaires.pluck(:email)
end
private
def user_geometry(dossier)

View file

@ -0,0 +1,5 @@
class RemoveTypeFromInvites < ActiveRecord::Migration[5.2]
def change
remove_column :invites, :type
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: 2018_10_02_164310) do
ActiveRecord::Schema.define(version: 2018_10_10_070424) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -384,7 +384,6 @@ ActiveRecord::Schema.define(version: 2018_10_02_164310) do
t.string "email_sender"
t.integer "dossier_id"
t.integer "user_id"
t.string "type", default: "InviteGestionnaire"
t.datetime "created_at"
t.datetime "updated_at"
end

View file

@ -139,7 +139,7 @@ describe API::V1::DossiersController do
let!(:dossier) { Timecop.freeze(date_creation) { create(:dossier, :with_entreprise, procedure: procedure, motivation: "Motivation") } }
let(:dossier_id) { dossier.id }
let(:body) { JSON.parse(retour.body, symbolize_names: true) }
let(:field_list) { [:id, :created_at, :updated_at, :archived, :individual, :entreprise, :etablissement, :cerfa, :types_de_piece_justificative, :pieces_justificatives, :champs, :champs_private, :commentaires, :state, :simplified_state, :initiated_at, :processed_at, :received_at, :motivation, :email, :instructeurs, :invites] }
let(:field_list) { [:id, :created_at, :updated_at, :archived, :individual, :entreprise, :etablissement, :cerfa, :types_de_piece_justificative, :pieces_justificatives, :champs, :champs_private, :commentaires, :state, :simplified_state, :initiated_at, :processed_at, :received_at, :motivation, :email, :instructeurs] }
subject { body[:dossier] }
it 'return REST code 200', :show_in_doc do