Sha256: 33fc364455448c2aff7ff3529f20dcce88d56599f38e2341cca91f1c7d8d5daa

Contents?: true

Size: 1.12 KB

Versions: 17

Compression:

Stored size: 1.12 KB

Contents

require 'pact_broker/domain/tag'
require 'pact_broker/repositories/helpers'


module PactBroker
  module Tags
    class Repository

      include PactBroker::Repositories::Helpers

      def create args
        Domain::Tag.new(name: args.fetch(:name), version: args.fetch(:version)).save
      end

      def find args
        PactBroker::Domain::Tag
          .select(Sequel.qualify("tags", "name"), Sequel.qualify("tags", "version_id"), Sequel.qualify("tags", "created_at"), Sequel.qualify("tags", "updated_at"))
          .join(:versions, {id: :version_id})
          .join(:pacticipants, {Sequel.qualify("pacticipants", "id") => Sequel.qualify("versions", "pacticipant_id")})
          .where(name_like(Sequel.qualify("tags", "name"), args.fetch(:tag_name)))
          .where(name_like(Sequel.qualify("versions", "number"), args.fetch(:pacticipant_version_number)))
          .where(name_like(Sequel.qualify("pacticipants", "name"), args.fetch(:pacticipant_name)))
          .single_record
      end

      def delete_by_version_id version_id
        Sequel::Model.db[:tags].where(version_id: version_id).delete
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
pact_broker-2.7.0.beta.2 lib/pact_broker/tags/repository.rb
pact_broker-2.7.0.beta.1 lib/pact_broker/tags/repository.rb
pact_broker-2.6.0 lib/pact_broker/tags/repository.rb
pact_broker-2.5.1 lib/pact_broker/tags/repository.rb
pact_broker-2.5.0 lib/pact_broker/tags/repository.rb
pact_broker-2.4.2 lib/pact_broker/tags/repository.rb
pact_broker-2.4.1 lib/pact_broker/tags/repository.rb
pact_broker-2.4.0 lib/pact_broker/tags/repository.rb
pact_broker-2.3.0 lib/pact_broker/tags/repository.rb
pact_broker-2.2.0 lib/pact_broker/tags/repository.rb
pact_broker-2.1.1 lib/pact_broker/tags/repository.rb
pact_broker-2.1.0 lib/pact_broker/tags/repository.rb
pact_broker-2.0.5 lib/pact_broker/tags/repository.rb
pact_broker-2.0.4 lib/pact_broker/tags/repository.rb
pact_broker-2.0.3 lib/pact_broker/tags/repository.rb
pact_broker-2.0.2 lib/pact_broker/tags/repository.rb
pact_broker-2.0.1 lib/pact_broker/tags/repository.rb