feat(DossierAsignment): create model
This commit is contained in:
parent
f313e4eaed
commit
5f5714678c
5 changed files with 53 additions and 1 deletions
|
@ -743,6 +743,7 @@ Rails/CreateTableWithTimestamps:
|
|||
- db/migrate/2017*.rb
|
||||
- db/migrate/2018*.rb
|
||||
- db/migrate/20200630140356_create_traitements.rb
|
||||
- db/migrate/20230630091637_create_dossier_assignments.rb
|
||||
|
||||
Rails/Date:
|
||||
Enabled: false
|
||||
|
|
|
@ -155,6 +155,8 @@ class Dossier < ApplicationRecord
|
|||
has_one :traitement, -> { order(processed_at: :desc) }, inverse_of: false
|
||||
|
||||
has_many :dossier_operation_logs, -> { order(:created_at) }, inverse_of: :dossier
|
||||
has_many :dossier_assignments, -> { order(:assigned_at) }, inverse_of: :dossier, dependent: :destroy
|
||||
has_one :dossier_assignment, -> { order(assigned_at: :desc) }, inverse_of: false
|
||||
|
||||
belongs_to :groupe_instructeur, optional: true
|
||||
belongs_to :revision, class_name: 'ProcedureRevision', optional: false
|
||||
|
|
22
app/models/dossier_assignment.rb
Normal file
22
app/models/dossier_assignment.rb
Normal file
|
@ -0,0 +1,22 @@
|
|||
# == Schema Information
|
||||
#
|
||||
# Table name: dossier_assignments
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# assigned_at :datetime not null
|
||||
# assigned_by :string
|
||||
# groupe_instructeur_label :string
|
||||
# mode :string not null
|
||||
# previous_groupe_instructeur_label :string
|
||||
# dossier_id :bigint not null
|
||||
# groupe_instructeur_id :bigint
|
||||
# previous_groupe_instructeur_id :bigint
|
||||
#
|
||||
class DossierAssignment < ApplicationRecord
|
||||
belongs_to :dossier
|
||||
|
||||
enum mode: {
|
||||
auto: 'auto',
|
||||
manual: 'manual'
|
||||
}
|
||||
end
|
14
db/migrate/20230630091637_create_dossier_assignments.rb
Normal file
14
db/migrate/20230630091637_create_dossier_assignments.rb
Normal file
|
@ -0,0 +1,14 @@
|
|||
class CreateDossierAssignments < ActiveRecord::Migration[7.0]
|
||||
def change
|
||||
create_table :dossier_assignments do |t|
|
||||
t.references :dossier, foreign_key: true, null: false
|
||||
t.string :mode, null: false
|
||||
t.bigint :groupe_instructeur_id
|
||||
t.bigint :previous_groupe_instructeur_id
|
||||
t.string :groupe_instructeur_label
|
||||
t.string :previous_groupe_instructeur_label
|
||||
t.string :assigned_by
|
||||
t.timestamp :assigned_at, null: false
|
||||
end
|
||||
end
|
||||
end
|
15
db/schema.rb
15
db/schema.rb
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[7.0].define(version: 2023_07_18_113720) do
|
||||
ActiveRecord::Schema[7.0].define(version: 2023_07_18_113820) do
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "pgcrypto"
|
||||
enable_extension "plpgsql"
|
||||
|
@ -307,6 +307,18 @@ ActiveRecord::Schema[7.0].define(version: 2023_07_18_113720) do
|
|||
t.index ["procedure_id"], name: "index_deleted_dossiers_on_procedure_id"
|
||||
end
|
||||
|
||||
create_table "dossier_assignments", force: :cascade do |t|
|
||||
t.datetime "assigned_at", precision: nil, null: false
|
||||
t.string "assigned_by"
|
||||
t.bigint "dossier_id", null: false
|
||||
t.bigint "groupe_instructeur_id"
|
||||
t.string "groupe_instructeur_label"
|
||||
t.string "mode", null: false
|
||||
t.bigint "previous_groupe_instructeur_id"
|
||||
t.string "previous_groupe_instructeur_label"
|
||||
t.index ["dossier_id"], name: "index_dossier_assignments_on_dossier_id"
|
||||
end
|
||||
|
||||
create_table "dossier_batch_operations", force: :cascade do |t|
|
||||
t.bigint "batch_operation_id", null: false
|
||||
t.datetime "created_at", precision: 6, null: false
|
||||
|
@ -1030,6 +1042,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_07_18_113720) do
|
|||
add_foreign_key "commentaires", "dossiers"
|
||||
add_foreign_key "commentaires", "experts"
|
||||
add_foreign_key "commentaires", "instructeurs"
|
||||
add_foreign_key "dossier_assignments", "dossiers"
|
||||
add_foreign_key "dossier_batch_operations", "batch_operations"
|
||||
add_foreign_key "dossier_batch_operations", "dossiers"
|
||||
add_foreign_key "dossier_corrections", "commentaires"
|
||||
|
|
Loading…
Reference in a new issue