feat(dossier): add some metadata to archive and remove operation log
This commit is contained in:
parent
7fc16581b5
commit
ece68076a7
5 changed files with 17 additions and 11 deletions
|
@ -113,7 +113,7 @@ module Instructeurs
|
|||
end
|
||||
|
||||
def unarchive
|
||||
dossier.desarchiver!(current_instructeur)
|
||||
dossier.desarchiver!
|
||||
redirect_back(fallback_location: instructeur_procedure_path(procedure))
|
||||
end
|
||||
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
# id :integer not null, primary key
|
||||
# api_entreprise_job_exceptions :string is an Array
|
||||
# archived :boolean default(FALSE)
|
||||
# archived_at :datetime
|
||||
# archived_by :string
|
||||
# autorisation_donnees :boolean
|
||||
# brouillon_close_to_expiration_notice_sent_at :datetime
|
||||
# conservation_extension :interval default(0 seconds)
|
||||
|
@ -636,14 +638,12 @@ class Dossier < ApplicationRecord
|
|||
end
|
||||
end
|
||||
|
||||
def archiver!(author)
|
||||
update!(archived: true)
|
||||
log_dossier_operation(author, :archiver)
|
||||
def archiver!(instructeur)
|
||||
update!(archived: true, archived_at: Time.zone.now, archived_by: instructeur.email)
|
||||
end
|
||||
|
||||
def desarchiver!(author)
|
||||
update!(archived: false)
|
||||
log_dossier_operation(author, :desarchiver)
|
||||
def desarchiver!
|
||||
update!(archived: false, archived_at: nil, archived_by: nil)
|
||||
end
|
||||
|
||||
def text_summary
|
||||
|
|
|
@ -26,9 +26,7 @@ class DossierOperationLog < ApplicationRecord
|
|||
supprimer: 'supprimer',
|
||||
restaurer: 'restaurer',
|
||||
modifier_annotation: 'modifier_annotation',
|
||||
demander_un_avis: 'demander_un_avis',
|
||||
archiver: 'archiver',
|
||||
desarchiver: 'desarchiver'
|
||||
demander_un_avis: 'demander_un_avis'
|
||||
}
|
||||
|
||||
has_one_attached :serialized
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
class AddArchivedAtAndArchivedByToDossiers < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_column :dossiers, :archived_at, :datetime
|
||||
add_column :dossiers, :archived_by, :string
|
||||
end
|
||||
end
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 2022_11_22_145030) do
|
||||
ActiveRecord::Schema.define(version: 2022_11_30_113745) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "pgcrypto"
|
||||
|
@ -304,6 +304,8 @@ ActiveRecord::Schema.define(version: 2022_11_22_145030) do
|
|||
create_table "dossiers", id: :serial, force: :cascade do |t|
|
||||
t.string "api_entreprise_job_exceptions", array: true
|
||||
t.boolean "archived", default: false
|
||||
t.datetime "archived_at"
|
||||
t.string "archived_by"
|
||||
t.boolean "autorisation_donnees"
|
||||
t.datetime "brouillon_close_to_expiration_notice_sent_at"
|
||||
t.interval "conservation_extension", default: "PT0S"
|
||||
|
|
Loading…
Reference in a new issue