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
|
end
|
||||||
|
|
||||||
def unarchive
|
def unarchive
|
||||||
dossier.desarchiver!(current_instructeur)
|
dossier.desarchiver!
|
||||||
redirect_back(fallback_location: instructeur_procedure_path(procedure))
|
redirect_back(fallback_location: instructeur_procedure_path(procedure))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
# id :integer not null, primary key
|
# id :integer not null, primary key
|
||||||
# api_entreprise_job_exceptions :string is an Array
|
# api_entreprise_job_exceptions :string is an Array
|
||||||
# archived :boolean default(FALSE)
|
# archived :boolean default(FALSE)
|
||||||
|
# archived_at :datetime
|
||||||
|
# archived_by :string
|
||||||
# autorisation_donnees :boolean
|
# autorisation_donnees :boolean
|
||||||
# brouillon_close_to_expiration_notice_sent_at :datetime
|
# brouillon_close_to_expiration_notice_sent_at :datetime
|
||||||
# conservation_extension :interval default(0 seconds)
|
# conservation_extension :interval default(0 seconds)
|
||||||
|
@ -636,14 +638,12 @@ class Dossier < ApplicationRecord
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def archiver!(author)
|
def archiver!(instructeur)
|
||||||
update!(archived: true)
|
update!(archived: true, archived_at: Time.zone.now, archived_by: instructeur.email)
|
||||||
log_dossier_operation(author, :archiver)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def desarchiver!(author)
|
def desarchiver!
|
||||||
update!(archived: false)
|
update!(archived: false, archived_at: nil, archived_by: nil)
|
||||||
log_dossier_operation(author, :desarchiver)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def text_summary
|
def text_summary
|
||||||
|
|
|
@ -26,9 +26,7 @@ class DossierOperationLog < ApplicationRecord
|
||||||
supprimer: 'supprimer',
|
supprimer: 'supprimer',
|
||||||
restaurer: 'restaurer',
|
restaurer: 'restaurer',
|
||||||
modifier_annotation: 'modifier_annotation',
|
modifier_annotation: 'modifier_annotation',
|
||||||
demander_un_avis: 'demander_un_avis',
|
demander_un_avis: 'demander_un_avis'
|
||||||
archiver: 'archiver',
|
|
||||||
desarchiver: 'desarchiver'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
has_one_attached :serialized
|
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.
|
# 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
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "pgcrypto"
|
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|
|
create_table "dossiers", id: :serial, force: :cascade do |t|
|
||||||
t.string "api_entreprise_job_exceptions", array: true
|
t.string "api_entreprise_job_exceptions", array: true
|
||||||
t.boolean "archived", default: false
|
t.boolean "archived", default: false
|
||||||
|
t.datetime "archived_at"
|
||||||
|
t.string "archived_by"
|
||||||
t.boolean "autorisation_donnees"
|
t.boolean "autorisation_donnees"
|
||||||
t.datetime "brouillon_close_to_expiration_notice_sent_at"
|
t.datetime "brouillon_close_to_expiration_notice_sent_at"
|
||||||
t.interval "conservation_extension", default: "PT0S"
|
t.interval "conservation_extension", default: "PT0S"
|
||||||
|
|
Loading…
Reference in a new issue