1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-12 23:09:03 +01:00
fab-manager/app/workers/child_age_worker.rb

16 lines
438 B
Ruby
Raw Normal View History

2023-07-12 09:29:16 +02:00
# frozen_string_literal: true
# send a notification if child age > 18 years ago
class ChildAgeWorker
include Sidekiq::Worker
def perform
children = Child.where('birthday = ?', 18.years.ago + 2.days)
children.each do |child|
NotificationCenter.call type: 'notify_user_when_child_age_will_be_18',
receiver: child.user,
attached_object: child
end
end
end