chore: one off SMS campaign APIs (#2589)

This commit is contained in:
Sojan Jose
2021-07-14 12:24:09 +05:30
committed by GitHub
parent cb44eb2964
commit dfddf9cacc
15 changed files with 337 additions and 23 deletions

View File

@@ -0,0 +1,7 @@
class Campaigns::TriggerOneoffCampaignJob < ApplicationJob
queue_as :low
def perform(campaign)
campaign.trigger!
end
end

View File

@@ -0,0 +1,10 @@
class TriggerScheduledItemsJob < ApplicationJob
queue_as :scheduled_jobs
def perform
# trigger the scheduled campaign jobs
Campaign.where(campaign_type: :one_off, campaign_status: :active).where(scheduled_at: 3.days.ago..Time.current).all.each do |campaign|
Campaigns::TriggerOneoffCampaignJob.perform_later(campaign)
end
end
end