2018-05-30 11:36:48 +02:00
|
|
|
class DeletedDossier < ApplicationRecord
|
|
|
|
belongs_to :procedure
|
2019-02-13 16:13:37 +01:00
|
|
|
|
2020-03-19 11:51:47 +01:00
|
|
|
enum reason: {
|
|
|
|
user_request: 'user_request',
|
|
|
|
manager_request: 'manager_request',
|
|
|
|
user_removed: 'user_removed',
|
|
|
|
expired: 'expired'
|
|
|
|
}
|
|
|
|
|
|
|
|
def self.create_from_dossier(dossier, reason)
|
|
|
|
create!(
|
|
|
|
reason: reasons.fetch(reason),
|
|
|
|
dossier_id: dossier.id,
|
|
|
|
procedure: dossier.procedure,
|
|
|
|
state: dossier.state,
|
|
|
|
deleted_at: Time.zone.now
|
|
|
|
)
|
2019-02-13 16:13:37 +01:00
|
|
|
end
|
2018-05-30 11:36:48 +02:00
|
|
|
end
|