Sha256: 39be79e638f33559eb1049ac6a5ac66ad0131d0945ee4db88a47de39670f0e35

Contents?: true

Size: 1.74 KB

Versions: 44

Compression:

Stored size: 1.74 KB

Contents

require "pact_broker/webhooks/triggered_webhook"

module PactBroker
  module Webhooks
    class LatestTriggeredWebhook < TriggeredWebhook
      SELF_JOIN = {
        Sequel[:triggered_webhooks][:webhook_uuid] => Sequel[:triggered_webhooks_2][:webhook_uuid],
        Sequel[:triggered_webhooks][:consumer_id] => Sequel[:triggered_webhooks_2][:consumer_id],
        Sequel[:triggered_webhooks][:provider_id] => Sequel[:triggered_webhooks_2][:provider_id],
        Sequel[:triggered_webhooks][:event_name] => Sequel[:triggered_webhooks_2][:event_name]
      }

      set_dataset(
        Sequel::Model.db[:triggered_webhooks]
          .select(Sequel[:triggered_webhooks].*)
          .exclude(Sequel[:triggered_webhooks][:event_name] => nil)
          .left_join(:triggered_webhooks, SELF_JOIN, { table_alias: :triggered_webhooks_2 }) do
            Sequel[:triggered_webhooks_2][:id] > Sequel[:triggered_webhooks][:id]
          end
          .where(Sequel[:triggered_webhooks_2][:id] => nil)
      )
    end
  end
end

# Table: latest_triggered_webhooks
# Columns:
#  id                  | integer                     |
#  trigger_uuid        | text                        |
#  trigger_type        | text                        |
#  pact_publication_id | integer                     |
#  webhook_id          | integer                     |
#  webhook_uuid        | text                        |
#  consumer_id         | integer                     |
#  provider_id         | integer                     |
#  status              | text                        |
#  created_at          | timestamp without time zone |
#  updated_at          | timestamp without time zone |
#  verification_id     | integer                     |
#  event_name          | text                        |

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
pact_broker-2.112.0 lib/pact_broker/webhooks/latest_triggered_webhook.rb
pact_broker-2.111.0 lib/pact_broker/webhooks/latest_triggered_webhook.rb
pact_broker-2.109.1 lib/pact_broker/webhooks/latest_triggered_webhook.rb
pact_broker-2.109.0 lib/pact_broker/webhooks/latest_triggered_webhook.rb
pact_broker-2.108.0 lib/pact_broker/webhooks/latest_triggered_webhook.rb
pact_broker-2.107.1 lib/pact_broker/webhooks/latest_triggered_webhook.rb
pact_broker-2.107.0 lib/pact_broker/webhooks/latest_triggered_webhook.rb
pact_broker-2.107.0.beta.1 lib/pact_broker/webhooks/latest_triggered_webhook.rb
pact_broker-2.106.0 lib/pact_broker/webhooks/latest_triggered_webhook.rb
pact_broker-2.105.0 lib/pact_broker/webhooks/latest_triggered_webhook.rb
pact_broker-2.104.0 lib/pact_broker/webhooks/latest_triggered_webhook.rb
pact_broker-2.103.0 lib/pact_broker/webhooks/latest_triggered_webhook.rb
pact_broker-2.102.2 lib/pact_broker/webhooks/latest_triggered_webhook.rb
pact_broker-2.102.1 lib/pact_broker/webhooks/latest_triggered_webhook.rb
pact_broker-2.102.0 lib/pact_broker/webhooks/latest_triggered_webhook.rb
pact_broker-2.101.0 lib/pact_broker/webhooks/latest_triggered_webhook.rb
pact_broker-2.100.0 lib/pact_broker/webhooks/latest_triggered_webhook.rb
pact_broker-2.99.0 lib/pact_broker/webhooks/latest_triggered_webhook.rb
pact_broker-2.98.0 lib/pact_broker/webhooks/latest_triggered_webhook.rb
pact_broker-2.97.0 lib/pact_broker/webhooks/latest_triggered_webhook.rb