2
2
require 'pact_broker/domain/verification'
3
3
require 'pact_broker/verifications/latest_verifications_by_consumer_version'
4
4
require 'pact_broker/verifications/all_verifications'
5
+ require 'pact_broker/verifications/sequence'
5
6
6
7
module PactBroker
7
8
module Verifications
@@ -10,6 +11,14 @@ class Repository
10
11
include PactBroker ::Repositories ::Helpers
11
12
include PactBroker ::Repositories
12
13
14
+ # Ideally this would just be a sequence, but Sqlite and MySQL don't support sequences
15
+ # in the way we need to use them ie. determining what the next number will be before we
16
+ # create the record, because Webmachine wants to set the URL of the resource that is about
17
+ # to be created *before* we actually create it.
18
+ def next_number
19
+ Sequence . next_val
20
+ end
21
+
13
22
def create verification , provider_version_number , pact
14
23
provider = pacticipant_repository . find_by_name ( pact . provider_name )
15
24
version = version_repository . find_by_pacticipant_id_and_number_or_create ( provider . id , provider_version_number )
@@ -18,10 +27,6 @@ def create verification, provider_version_number, pact
18
27
verification . save
19
28
end
20
29
21
- def verification_count_for_pact pact
22
- PactBroker ::Domain ::Verification . where ( pact_version_id : pact_version_id_for ( pact ) ) . count
23
- end
24
-
25
30
def find consumer_name , provider_name , pact_version_sha , verification_number
26
31
PactBroker ::Domain ::Verification
27
32
. select_all_qualified
0 commit comments