feat(User): add maintenance task to backfill email_verified_at
This commit is contained in:
parent
1cf9535bea
commit
555df3a6d8
2 changed files with 34 additions and 0 deletions
|
@ -0,0 +1,17 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# We are going to confirm the various email addresses of the users in the system.
|
||||
# Individual model (mandant) needs their email_verified_at attribute to be set in order to receive emails.
|
||||
# This task sets the email_verified_at attribute to the current time for all the individual to be backward compatible
|
||||
# See https://github.com/demarches-simplifiees/demarches-simplifiees.fr/issues/10450
|
||||
module Maintenance
|
||||
class PrefillIndividualEmailVerifiedAtTask < MaintenanceTasks::Task
|
||||
def collection
|
||||
Individual.in_batches
|
||||
end
|
||||
|
||||
def process(batch_of_individuals)
|
||||
batch_of_individuals.update_all(email_verified_at: Time.zone.now)
|
||||
end
|
||||
end
|
||||
end
|
17
app/tasks/maintenance/prefill_user_email_verified_at_task.rb
Normal file
17
app/tasks/maintenance/prefill_user_email_verified_at_task.rb
Normal file
|
@ -0,0 +1,17 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# We are going to confirm the various email addresses of the users in the system.
|
||||
# User model needs their email_verified_at attribute to be set in order to receive emails.
|
||||
# This task sets the email_verified_at attribute to the current time for all users to be backward compatible
|
||||
# See https://github.com/demarches-simplifiees/demarches-simplifiees.fr/issues/10450
|
||||
module Maintenance
|
||||
class PrefillUserEmailVerifiedAtTask < MaintenanceTasks::Task
|
||||
def collection
|
||||
User.in_batches
|
||||
end
|
||||
|
||||
def process(batch_of_users)
|
||||
batch_of_users.update_all(email_verified_at: Time.zone.now)
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue