Sha256: b18f7868b164d7febb9b9c0694e43cbf47c63345f6f7b0fbe7602bf8b8ad3c37

Contents?: true

Size: 1.12 KB

Versions: 2

Compression:

Stored size: 1.12 KB

Contents

require 'sequel'
require 'pact_broker/db'
require 'pact_broker/repositories/helpers'


module PactBroker
  module Webhooks
    class Execution < Sequel::Model(
      PactBroker::DB.connection[:webhook_executions].select(
        Sequel[:webhook_executions][:id],
        :triggered_webhook_id,
        :success,
        :logs,
        Sequel[:webhook_executions][:created_at])
      )

      dataset_module do
        include PactBroker::Repositories::Helpers
      end

      associate(:many_to_one, :triggered_webhook, :class => "PactBroker::Webhooks::TriggeredWebhook", :key => :triggered_webhook_id, :primary_key => :id)

      def <=> other
        comp = created_date <=> other.created_date
        comp = id <=> other.id if comp == 0
        comp
      end
    end

    class DeprecatedExecution < Sequel::Model(:webhook_executions)
      associate(:many_to_one, :provider, :class => "PactBroker::Domain::Pacticipant", :key => :provider_id, :primary_key => :id)
      associate(:many_to_one, :consumer, :class => "PactBroker::Domain::Pacticipant", :key => :consumer_id, :primary_key => :id)
    end

    Execution.plugin :timestamps

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pact_broker-2.5.1 lib/pact_broker/webhooks/execution.rb
pact_broker-2.5.0 lib/pact_broker/webhooks/execution.rb