pact_broker 1.3.1 → 1.3.2.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (110) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +11 -0
  3. data/README.md +12 -0
  4. data/db/migrations/07_increase_json_content_length.rb +3 -7
  5. data/db/migrations/15_add_value_to_tag.rb.wip +5 -0
  6. data/db/migrations/15_create_pact_version_content.rb +13 -0
  7. data/db/migrations/16_add_pact_content_foreign_key_to_pacts.rb +10 -0
  8. data/db/migrations/17_migrate_json_content_to_pact_version_content_table.rb +14 -0
  9. data/db/migrations/18_drop_json_content_column_from_pacts.rb +14 -0
  10. data/db/migrations/19_make_pact_version_content_sha_not_nullable.rb +10 -0
  11. data/db/migrations/20_add_pact_version_content_sha_to_all_pacts_view.rb +18 -0
  12. data/db/migrations/21_recreate_latest_pacts_view.rb +21 -0
  13. data/db/migrations/migration_helper.rb +15 -0
  14. data/db/pact_broker_database.sqlite3 +0 -0
  15. data/example/config.ru +5 -1
  16. data/example/pact_broker_database.sqlite3 +0 -0
  17. data/lib/pact_broker/api/decorators/pact_collection_decorator.rb +1 -1
  18. data/lib/pact_broker/api/decorators/pact_pacticipant_decorator.rb +1 -1
  19. data/lib/pact_broker/api/decorators/pacticipant_collection_decorator.rb +1 -1
  20. data/lib/pact_broker/api/decorators/pacticipant_decorator.rb +1 -1
  21. data/lib/pact_broker/api/decorators/relationships_csv_decorator.rb +1 -1
  22. data/lib/pact_broker/api/decorators/webhook_decorator.rb +2 -2
  23. data/lib/pact_broker/api/renderers/html_pact_renderer.rb +1 -1
  24. data/lib/pact_broker/api/resources/pact.rb +8 -1
  25. data/lib/pact_broker/api/resources/pact_webhooks.rb +1 -1
  26. data/lib/pact_broker/api/resources/pacticipants.rb +2 -2
  27. data/lib/pact_broker/db/validate_encoding.rb +22 -0
  28. data/lib/pact_broker/doc/views/pacticipants.markdown +3 -1
  29. data/lib/pact_broker/domain.rb +5 -0
  30. data/lib/pact_broker/{models → domain}/group.rb +1 -1
  31. data/lib/pact_broker/{models → domain}/order_versions.rb +2 -2
  32. data/lib/pact_broker/{models → domain}/pact.rb +1 -1
  33. data/lib/pact_broker/{models → domain}/pacticipant.rb +1 -1
  34. data/lib/pact_broker/{models → domain}/relationship.rb +1 -1
  35. data/lib/pact_broker/{models → domain}/tag.rb +2 -2
  36. data/lib/pact_broker/{models → domain}/version.rb +3 -3
  37. data/lib/pact_broker/{models → domain}/webhook.rb +2 -2
  38. data/lib/pact_broker/{models → domain}/webhook_execution_result.rb +1 -1
  39. data/lib/pact_broker/{models → domain}/webhook_request.rb +3 -3
  40. data/lib/pact_broker/{models → domain}/webhook_request_header.rb +1 -1
  41. data/lib/pact_broker/functions/find_potential_duplicate_pacticipant_names.rb +1 -1
  42. data/lib/pact_broker/functions/groupify.rb +2 -2
  43. data/lib/pact_broker/locale/en.yml +1 -0
  44. data/lib/pact_broker/pacts/all_pacts.rb +82 -0
  45. data/lib/pact_broker/pacts/database_model.rb +35 -0
  46. data/lib/pact_broker/pacts/latest_pacts.rb +11 -0
  47. data/lib/pact_broker/pacts/pact_version_content.rb +11 -0
  48. data/lib/pact_broker/pacts/repository.rb +106 -0
  49. data/lib/pact_broker/repositories.rb +3 -3
  50. data/lib/pact_broker/repositories/pacticipant_repository.rb +6 -6
  51. data/lib/pact_broker/repositories/tag_repository.rb +3 -3
  52. data/lib/pact_broker/repositories/version_repository.rb +5 -5
  53. data/lib/pact_broker/repositories/webhook.rb +89 -0
  54. data/lib/pact_broker/repositories/webhook_repository.rb +9 -94
  55. data/lib/pact_broker/services/pact_service.rb +4 -0
  56. data/lib/pact_broker/services/pacticipant_service.rb +3 -3
  57. data/lib/pact_broker/ui.rb +7 -0
  58. data/lib/pact_broker/ui/controllers/clusters.rb +1 -1
  59. data/lib/pact_broker/ui/controllers/relationships.rb +1 -1
  60. data/lib/pact_broker/ui/view_models/relationship.rb +1 -1
  61. data/lib/pact_broker/ui/view_models/relationships.rb +12 -3
  62. data/lib/pact_broker/ui/views/relationships/show.haml +2 -0
  63. data/lib/pact_broker/version.rb +1 -1
  64. data/public/stylesheets/relationships.css +5 -0
  65. data/spec/features/create_webhook_spec.rb +77 -0
  66. data/spec/features/delete_pact_spec.rb +28 -0
  67. data/spec/features/publish_pact_spec.rb +58 -0
  68. data/spec/features/update_pacticipant_spec.rb +26 -0
  69. data/spec/fixtures/update_pacticipant.json +5 -0
  70. data/spec/fixtures/updated_pacticipant.json +11 -0
  71. data/spec/integration/app_spec.rb +1 -4
  72. data/spec/lib/pact_broker/api/contracts/webhook_contract_spec.rb +1 -1
  73. data/spec/lib/pact_broker/api/decorators/pact_collection_decorator_spec.rb +5 -5
  74. data/spec/lib/pact_broker/api/decorators/pact_decorator_spec.rb +3 -3
  75. data/spec/lib/pact_broker/api/decorators/pact_version_decorator_spec.rb +3 -3
  76. data/spec/lib/pact_broker/api/decorators/pacticipant_decorator_spec.rb +2 -2
  77. data/spec/lib/pact_broker/api/decorators/webhook_decorator_spec.rb +6 -6
  78. data/spec/lib/pact_broker/api/decorators/webhook_execution_result_decorator_spec.rb +2 -2
  79. data/spec/lib/pact_broker/api/decorators/webhook_request_decorator_spec.rb +2 -2
  80. data/spec/lib/pact_broker/api/decorators/webhooks_decorator_spec.rb +1 -1
  81. data/spec/lib/pact_broker/api/renderers/html_pact_renderer_spec.rb +1 -1
  82. data/spec/lib/pact_broker/api/resources/pact_spec.rb +34 -1
  83. data/spec/lib/pact_broker/api/resources/pact_webhooks_spec.rb +3 -3
  84. data/spec/lib/pact_broker/api/resources/pacticipants_spec.rb +1 -1
  85. data/spec/lib/pact_broker/api/resources/tag_spec.rb +1 -1
  86. data/spec/lib/pact_broker/db/validate_encoding_spec.rb +66 -0
  87. data/spec/lib/pact_broker/{models → domain}/group_spec.rb +5 -5
  88. data/spec/lib/pact_broker/{models → domain}/order_versions_spec.rb +4 -4
  89. data/spec/lib/pact_broker/{models → domain}/pacticipant_spec.rb +2 -2
  90. data/spec/lib/pact_broker/{models → domain}/webhook_request_spec.rb +2 -2
  91. data/spec/lib/pact_broker/{models → domain}/webhook_spec.rb +3 -3
  92. data/spec/lib/pact_broker/functions/groupify_spec.rb +10 -10
  93. data/spec/lib/pact_broker/{repositories/pact_repository_spec.rb → pacts/repository_spec.rb} +128 -28
  94. data/spec/lib/pact_broker/repositories/webhook_repository_spec.rb +3 -3
  95. data/spec/lib/pact_broker/services/group_service_spec.rb +4 -4
  96. data/spec/lib/pact_broker/services/pact_service_spec.rb +4 -4
  97. data/spec/lib/pact_broker/services/pacticipant_service_spec.rb +11 -11
  98. data/spec/lib/pact_broker/services/webhook_service_spec.rb +5 -5
  99. data/spec/lib/pact_broker/ui/controllers/relationships_spec.rb +3 -3
  100. data/spec/lib/pact_broker/ui/view_models/relationship_spec.rb +8 -8
  101. data/spec/lib/pact_broker/ui/view_models/relationships_spec.rb +28 -5
  102. data/spec/support/provider_state_builder.rb +17 -17
  103. data/tasks/db.rake +1 -2
  104. metadata +59 -35
  105. data/lib/pact_broker/jobs/after_pact_save.rb +0 -13
  106. data/lib/pact_broker/models.rb +0 -5
  107. data/lib/pact_broker/repositories/pact.rb +0 -29
  108. data/lib/pact_broker/repositories/pact_repository.rb +0 -140
  109. data/spec/integration/endpoints/pact_put_spec.rb +0 -59
  110. data/spec/integration/endpoints/pact_webhooks_spec.rb +0 -96
@@ -1,5 +1,5 @@
1
1
  module PactBroker
2
- module Models
2
+ module Domain
3
3
 
4
4
  class Relationship
5
5
 
@@ -2,12 +2,12 @@ require 'pact_broker/db'
2
2
 
3
3
  module PactBroker
4
4
 
5
- module Models
5
+ module Domain
6
6
  class Tag < Sequel::Model
7
7
 
8
8
  unrestrict_primary_key
9
9
 
10
- associate(:many_to_one, :version, :class => "PactBroker::Models::Version", :key => :version_id, :primary_key => :id)
10
+ associate(:many_to_one, :version, :class => "PactBroker::Domain::Version", :key => :version_id, :primary_key => :id)
11
11
 
12
12
 
13
13
  end
@@ -1,15 +1,15 @@
1
1
  require 'pact_broker/db'
2
- require 'pact_broker/models/order_versions'
2
+ require 'pact_broker/domain/order_versions'
3
3
 
4
4
  module PactBroker
5
5
 
6
- module Models
6
+ module Domain
7
7
 
8
8
  class Version < Sequel::Model
9
9
 
10
10
  set_primary_key :id
11
11
  one_to_many :pacts
12
- associate(:many_to_one, :pacticipant, :class => "PactBroker::Models::Pacticipant", :key => :pacticipant_id, :primary_key => :id)
12
+ associate(:many_to_one, :pacticipant, :class => "PactBroker::Domain::Pacticipant", :key => :pacticipant_id, :primary_key => :id)
13
13
  one_to_many :tags, :reciprocal => :version
14
14
 
15
15
  def after_create
@@ -1,11 +1,11 @@
1
- require 'pact_broker/models/webhook_request'
1
+ require 'pact_broker/domain/webhook_request'
2
2
  require 'pact_broker/messages'
3
3
  require 'pact_broker/logging'
4
4
  require 'pact_broker/api/contracts/webhook_contract'
5
5
 
6
6
  module PactBroker
7
7
 
8
- module Models
8
+ module Domain
9
9
 
10
10
  class Webhook
11
11
 
@@ -1,6 +1,6 @@
1
1
  module PactBroker
2
2
 
3
- module Models
3
+ module Domain
4
4
 
5
5
  class WebhookExecutionResult
6
6
 
@@ -1,12 +1,12 @@
1
- require 'pact_broker/models/webhook_request_header'
2
- require 'pact_broker/models/webhook_execution_result'
1
+ require 'pact_broker/domain/webhook_request_header'
2
+ require 'pact_broker/domain/webhook_execution_result'
3
3
  require 'pact_broker/logging'
4
4
  require 'pact_broker/messages'
5
5
  require 'net/http'
6
6
 
7
7
  module PactBroker
8
8
 
9
- module Models
9
+ module Domain
10
10
 
11
11
  class WebhookRequestError < StandardError
12
12
 
@@ -1,5 +1,5 @@
1
1
  module PactBroker
2
- module Models
2
+ module Domain
3
3
  class WebhookRequestHeader
4
4
 
5
5
  attr_accessor :name, :value
@@ -1,4 +1,4 @@
1
- require 'pact_broker/models/group'
1
+ require 'pact_broker/domain/group'
2
2
 
3
3
  =begin
4
4
 
@@ -1,4 +1,4 @@
1
- require 'pact_broker/models/group'
1
+ require 'pact_broker/domain/group'
2
2
 
3
3
  =begin
4
4
  Splits all relationships up into groups of non-connecting relationships.
@@ -11,7 +11,7 @@ module PactBroker
11
11
  class Groupify
12
12
 
13
13
  def self.call relationships
14
- recurse_groups([], relationships.dup).collect{ | group | Models::Group.new(group) }
14
+ recurse_groups([], relationships.dup).collect{ | group | Domain::Group.new(group) }
15
15
  end
16
16
 
17
17
  def self.recurse_groups groups, relationship_pool
@@ -11,6 +11,7 @@ en:
11
11
  consumer_version_number_header_invalid: "X-Pact-Consumer-Version '%{consumer_version_number}' is not recognised as a standard semantic version. eg. 1.3.0 or 2.0.4.rc1"
12
12
  consumer_version_number_invalid: "Consumer version number '%{consumer_version_number}' is not recognised as a standard semantic version. eg. 1.3.0 or 2.0.4.rc1"
13
13
  pacticipant_name_mismatch: "in pact ('%{name_in_pact}') does not match %{pacticipant} name in path ('%{name}')."
14
+ connection_encoding_not_utf8: "The Sequel connection encoding (%{encoding}) is strongly recommended to be \"utf8\". If you need to set it to %{encoding} for some particular reason, then disable this check by setting config.validate_database_connection_config = false"
14
15
  duplicate_pacticipant: |
15
16
  This is the first time a pact has been published for "%{new_name}".
16
17
  The name "%{new_name}" is very similar to the following existing consumers/providers:
@@ -0,0 +1,82 @@
1
+ require 'pact_broker/domain/tag'
2
+ require 'pact_broker/domain/pacticipant'
3
+ require 'pact_broker/domain/version'
4
+ require 'pact_broker/pacts/pact_version_content'
5
+
6
+ module PactBroker
7
+ module Pacts
8
+
9
+ class AllPacts < Sequel::Model(:all_pacts)
10
+
11
+
12
+ set_primary_key :id
13
+ associate(:one_to_many, :tags, :class => "PactBroker::Domain::Tag", :reciprocal => :version, :key => :version_id, :primary_key => :consumer_version_id)
14
+ associate(:many_to_one, :pact_version_content, :key => :pact_version_content_sha, :primary_key => :sha)
15
+
16
+ dataset_module do
17
+ # def latest_versions
18
+ # join(:latest_pact_consumer_version_orders,
19
+ # {
20
+ # consumer_id: :consumer_id,
21
+ # provider_id: :provider_id,
22
+ # latest_consumer_version_order: :consumer_version_order
23
+ # },
24
+ # {table_alias: :lp}
25
+ # )
26
+ # end
27
+
28
+ def consumer consumer_name
29
+ filter(consumer_name: consumer_name)
30
+ end
31
+
32
+ def provider provider_name
33
+ filter(provider_name: provider_name)
34
+ end
35
+
36
+ def tag tag_name
37
+ join(:tags, {version_id: :consumer_version_id})
38
+ .where('tags.name = ?', tag_name)
39
+ end
40
+
41
+ def consumer_version_number number
42
+ filter(consumer_version_number: number)
43
+ end
44
+
45
+ def consumer_version_order_before order
46
+ where('consumer_version_order < ?', order)
47
+ end
48
+
49
+ def latest
50
+ reverse_order(:consumer_version_order).limit(1)
51
+ end
52
+ end
53
+
54
+ def to_domain
55
+ consumer = Domain::Pacticipant.new(name: consumer_name)
56
+ consumer.id = consumer_id
57
+ provider = Domain::Pacticipant.new(name: provider_name)
58
+ provider.id = provider_id
59
+ consumer_version = OpenStruct.new(
60
+ number: consumer_version_number,
61
+ order: consumer_version_order,
62
+ pacticipant: consumer,
63
+ tags: tags)
64
+ Domain::Pact.new(id: id,
65
+ consumer: consumer,
66
+ consumer_version: consumer_version,
67
+ provider: provider,
68
+ consumer_version_number: consumer_version_number,
69
+ created_at: created_at,
70
+ updated_at: updated_at)
71
+ end
72
+
73
+ def to_domain_with_content
74
+ to_domain.tap do | pact |
75
+ pact.json_content = pact_version_content.content
76
+ end
77
+ end
78
+
79
+ end
80
+
81
+ end
82
+ end
@@ -0,0 +1,35 @@
1
+ require 'pact_broker/domain/pact'
2
+ require 'pact_broker/pacts/pact_version_content'
3
+
4
+ module PactBroker
5
+ module Pacts
6
+
7
+ class DatabaseModel < Sequel::Model(:pacts)
8
+
9
+ set_primary_key :id
10
+ associate(:many_to_one, :provider, :class => "PactBroker::Domain::Pacticipant", :key => :provider_id, :primary_key => :id)
11
+ associate(:many_to_one, :consumer_version, :class => "PactBroker::Domain::Version", :key => :version_id, :primary_key => :id)
12
+ associate(:many_to_one, :pact_version_content, :key => :pact_version_content_sha, :primary_key => :sha)
13
+
14
+ DatabaseModel.plugin :timestamps, :update_on_create=>true
15
+
16
+ def to_domain
17
+ PactBroker::Domain::Pact.new(
18
+ id: id,
19
+ provider: provider,
20
+ consumer: consumer_version.pacticipant,
21
+ consumer_version_number: consumer_version.number,
22
+ consumer_version: to_version_domain,
23
+ json_content: pact_version_content.content,
24
+ updated_at: updated_at,
25
+ created_at: created_at
26
+ )
27
+ end
28
+
29
+ def to_version_domain
30
+ OpenStruct.new(number: consumer_version.number, pacticipant: consumer_version.pacticipant, tags: consumer_version.tags, order: consumer_version.order)
31
+ end
32
+
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,11 @@
1
+ require 'pact_broker/pacts/all_pacts'
2
+
3
+ module PactBroker
4
+ module Pacts
5
+
6
+ class LatestPacts < AllPacts
7
+ set_dataset(:latest_pacts)
8
+ end
9
+
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ require 'sequel'
2
+
3
+ module PactBroker
4
+ module Pacts
5
+ class PactVersionContent < Sequel::Model(:pact_version_contents)
6
+ set_primary_key :sha
7
+ end
8
+
9
+ PactVersionContent.plugin :timestamps, :update_on_create=>true
10
+ end
11
+ end
@@ -0,0 +1,106 @@
1
+ require 'digest/sha1'
2
+ require 'sequel'
3
+ require 'ostruct'
4
+ require 'pact_broker/logging'
5
+ require 'pact_broker/pacts/database_model'
6
+ require 'pact_broker/pacts/all_pacts'
7
+ require 'pact_broker/pacts/latest_pacts'
8
+
9
+ module PactBroker
10
+ module Pacts
11
+ class Repository
12
+
13
+ include PactBroker::Logging
14
+
15
+ def create params
16
+ DatabaseModel.new(
17
+ version_id: params[:version_id],
18
+ provider_id: params[:provider_id],
19
+ pact_version_content: find_or_create_pact_version_content(params[:json_content]),
20
+ ).save.to_domain
21
+ end
22
+
23
+ def update id, params
24
+ DatabaseModel.find(id: id).tap do | pact |
25
+ pact_version_content = find_or_create_pact_version_content(params[:json_content])
26
+ pact.update(pact_version_content: pact_version_content)
27
+ end.to_domain
28
+ end
29
+
30
+ def delete params
31
+ id = AllPacts
32
+ .consumer(params.consumer_name)
33
+ .provider(params.provider_name)
34
+ .consumer_version_number(params.consumer_version_number)
35
+ .limit(1).first.id
36
+ DatabaseModel.where(id: id).delete
37
+ end
38
+
39
+ def find_all_pacts_between consumer_name, options
40
+ AllPacts
41
+ .eager(:tags)
42
+ .consumer(consumer_name)
43
+ .provider(options.fetch(:and))
44
+ .reverse_order(:consumer_version_order)
45
+ .collect(&:to_domain)
46
+ end
47
+
48
+ def find_by_version_and_provider version_id, provider_id
49
+ AllPacts
50
+ .eager(:tags)
51
+ .where(consumer_version_id: version_id, provider_id: provider_id)
52
+ .limit(1).collect(&:to_domain)[0]
53
+ end
54
+
55
+ def find_latest_pacts
56
+ LatestPacts.collect(&:to_domain)
57
+ end
58
+
59
+ def find_latest_pact(consumer_name, provider_name, tag = nil)
60
+ query = AllPacts
61
+ .consumer(consumer_name)
62
+ .provider(provider_name)
63
+ query = query.tag(tag) unless tag.nil?
64
+ query.latest.all.collect(&:to_domain_with_content)[0]
65
+ end
66
+
67
+ def find_pact consumer_name, consumer_version, provider_name
68
+ AllPacts
69
+ .eager(:tags)
70
+ .consumer(consumer_name)
71
+ .provider(provider_name)
72
+ .consumer_version_number(consumer_version)
73
+ .limit(1).collect(&:to_domain_with_content)[0]
74
+ end
75
+
76
+ def find_previous_pact pact
77
+ AllPacts
78
+ .eager(:tags)
79
+ .consumer(pact.consumer.name)
80
+ .provider(pact.provider.name)
81
+ .consumer_version_order_before(pact.consumer_version.order)
82
+ .latest.collect(&:to_domain)[0]
83
+ end
84
+
85
+ private
86
+
87
+ def find_or_create_pact_version_content json_content
88
+ sha = Digest::SHA1.hexdigest(json_content)
89
+ PactVersionContent.find(sha: sha) || create_pact_version_content(sha, json_content)
90
+ end
91
+
92
+ def create_pact_version_content sha, json_content
93
+ PactBroker.logger.debug("Creating new PactVersionContent for sha #{sha}")
94
+ pact_version_content = PactVersionContent.new(content: json_content)
95
+ pact_version_content[:sha] = sha
96
+ pact_version_content.save
97
+ end
98
+
99
+ def to_domain
100
+ database_model = yield
101
+ database_model ? database_model.to_domain : nil
102
+ end
103
+
104
+ end
105
+ end
106
+ end
@@ -1,7 +1,7 @@
1
- require 'pact_broker/models'
1
+ require 'pact_broker/domain'
2
2
  require 'pact_broker/repositories/pacticipant_repository'
3
3
  require 'pact_broker/repositories/version_repository'
4
- require 'pact_broker/repositories/pact_repository'
4
+ require 'pact_broker/pacts/repository'
5
5
  require 'pact_broker/repositories/tag_repository'
6
6
  require 'pact_broker/repositories/webhook_repository'
7
7
 
@@ -17,7 +17,7 @@ module PactBroker
17
17
  end
18
18
 
19
19
  def pact_repository
20
- PactRepository.new
20
+ PactBroker::Pacts::Repository.new
21
21
  end
22
22
 
23
23
  def tag_repository
@@ -1,20 +1,20 @@
1
1
  require 'sequel'
2
- require 'pact_broker/models/pacticipant'
2
+ require 'pact_broker/domain/pacticipant'
3
3
 
4
4
  module PactBroker
5
5
  module Repositories
6
6
  class PacticipantRepository
7
7
 
8
8
  def find_by_name name
9
- PactBroker::Models::Pacticipant.where(name: name).single_record
9
+ PactBroker::Domain::Pacticipant.where(name: name).single_record
10
10
  end
11
11
 
12
12
  def find_by_id id
13
- PactBroker::Models::Pacticipant.where(id: id).single_record
13
+ PactBroker::Domain::Pacticipant.where(id: id).single_record
14
14
  end
15
15
 
16
16
  def find_all
17
- PactBroker::Models::Pacticipant.order(:name).all
17
+ PactBroker::Domain::Pacticipant.order(:name).all
18
18
  end
19
19
 
20
20
  def find_by_name_or_create name
@@ -26,11 +26,11 @@ module PactBroker
26
26
  end
27
27
 
28
28
  def create args
29
- PactBroker::Models::Pacticipant.new(name: args[:name], repository_url: args[:repository_url]).save(raise_on_save_failure: true)
29
+ PactBroker::Domain::Pacticipant.new(name: args[:name], repository_url: args[:repository_url]).save(raise_on_save_failure: true)
30
30
  end
31
31
 
32
32
  def pacticipant_names
33
- PactBroker::Models::Pacticipant.select(:name).order(:name).collect{ | pacticipant| pacticipant.name }
33
+ PactBroker::Domain::Pacticipant.select(:name).order(:name).collect{ | pacticipant| pacticipant.name }
34
34
  end
35
35
 
36
36
  def find_latest_version name
@@ -1,4 +1,4 @@
1
- require 'pact_broker/models/tag'
1
+ require 'pact_broker/domain/tag'
2
2
 
3
3
  module PactBroker
4
4
  module Repositories
@@ -6,11 +6,11 @@ module PactBroker
6
6
 
7
7
 
8
8
  def create args
9
- Models::Tag.new(name: args.fetch(:name), version: args.fetch(:version)).save
9
+ Domain::Tag.new(name: args.fetch(:name), version: args.fetch(:version)).save
10
10
  end
11
11
 
12
12
  def find args
13
- PactBroker::Models::Tag
13
+ PactBroker::Domain::Tag
14
14
  .select(:tags__name, :tags__version_id, :tags__created_at, :tags__updated_at)
15
15
  .join(:versions, {id: :version_id})
16
16
  .join(:pacticipants, {pacticipants__id: :versions__pacticipant_id})