Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
nudded committed Dec 23, 2024
1 parent e7534d3 commit 86f62c4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/models/subscription_event_trigger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,15 @@
class SubscriptionEventTrigger < ApplicationRecord
validates :organization_id, :external_subscription_id, :created_at, presence: true

scope :ordered, -> { order(created_at: :desc) }

def self.trigger(organization_id:, external_subscription_id:)
connection.select_all sanitize_sql_array(["call trigger_subscription_update(?,?, null)", organization_id, external_subscription_id])
end

def self.take
candidate = SubscriptionEventTrigger.ordered.limit(1)
end
end

# == Schema Information
Expand Down

0 comments on commit 86f62c4

Please sign in to comment.