15 lines
409 B
Ruby
15 lines
409 B
Ruby
require Rails.root.join("lib", "tasks", "task_helper")
|
|
|
|
namespace :token_expiration_email do
|
|
task send_warning: :environment do
|
|
admin_tokens = APIToken
|
|
.includes(:administrateur)
|
|
.where(version: [1, 2])
|
|
.to_a
|
|
.group_by(&:administrateur)
|
|
|
|
admin_tokens.each do |admin, tokens|
|
|
AdministrateurMailer.api_token_expiration(admin.user, tokens).deliver_later
|
|
end
|
|
end
|
|
end
|