Bug 30855: Rename /import => /import_batches

This patch renames the route to make it consistent for future additions.

To test:
1. Run
   $ git grep 'matches/chosen'
=> FAIL: all occurences use /api/v1/import/
2. Apply this patch
3. Run:
   $ git grep 'matches/chosen'
=> SUCCESS: All occurences have '/api/v1/import_batches/'
4. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/import_record_matches.t
=> SUCCESS: Tests pass!
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Tomas Cohen Arazi 2022-05-26 11:17:18 -03:00
parent 022330b8d2
commit 891972d0d3
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
5 changed files with 10 additions and 10 deletions

View File

@ -33,7 +33,7 @@ use Try::Tiny;
Method that handles unselecting all chosen matches for an import record
DELETE /api/v1/import/{import_batch_id}/records/{import_record_id}/matches/chosen
DELETE /api/v1/import_batches/{import_batch_id}/records/{import_record_id}/matches/chosen
=cut
@ -63,7 +63,7 @@ sub unset_chosen {
Method that handles modifying if a Koha::Import::Record::Match object has been chosen for overlay
PUT /api/v1/import/{import_batch_id}/records/{import_record_id}/matches/chosen
PUT /api/v1/import_batches/{import_batch_id}/records/{import_record_id}/matches/chosen
Body should contain the condidate_match_id to chose

View File

@ -1,5 +1,5 @@
---
"/import/{import_batch_id}/records/{import_record_id}/matches/chosen":
"/import_batches/{import_batch_id}/records/{import_record_id}/matches/chosen":
put:
x-mojo-to: ImportRecordMatches#set_chosen
operationId: setChosen

View File

@ -143,8 +143,8 @@ paths:
$ref: "./paths/ill_backends.yaml#/~1ill_backends~1{ill_backend_id}"
/illrequests:
$ref: ./paths/illrequests.yaml#/~1illrequests
"/import/{import_batch_id}/records/{import_record_id}/matches/chosen":
$ref: "./paths/import_record_matches.yaml#/~1import~1{import_batch_id}~1records~1{import_record_id}~1matches~1chosen"
"/import_batches/{import_batch_id}/records/{import_record_id}/matches/chosen":
$ref: "./paths/import_batches.yaml#/~1import_batches~1{import_batch_id}~1records~1{import_record_id}~1matches~1chosen"
/import_batch_profiles:
$ref: ./paths/import_batch_profiles.yaml#/~1import_batch_profiles
"/import_batch_profiles/{import_batch_profile_id}":

View File

@ -621,7 +621,7 @@
apidata = JSON.stringify({ candidate_match_id: $(this).val() });
}
$.ajax({
url: '/api/v1/import/[% import_batch_id | html %]/records/'+$(this).data('import_record_id')+'/matches/chosen',
url: '/api/v1/import_batches/[% import_batch_id | html %]/records/'+$(this).data('import_record_id')+'/matches/chosen',
method: apimethod,
data: apidata,
contentType: 'application/json'

View File

@ -67,7 +67,7 @@ subtest 'import record matches tests' => sub {
# Unauthorized attempt to update
my $tx = $t->ua->build_tx(
PUT => "/api/v1/import/".$match_1->import_record->import_batch_id."/records/".$match_1->import_record_id."/matches/chosen"=>
PUT => "/api/v1/import_batches/".$match_1->import_record->import_batch_id."/records/".$match_1->import_record_id."/matches/chosen"=>
json => {
candidate_match_id => $match_1->candidate_match_id
}
@ -79,7 +79,7 @@ subtest 'import record matches tests' => sub {
# Invalid attempt to allow match on a non-existent record
$tx = $t->ua->build_tx(
PUT => "/api/v1/import/".$del_import_batch_id."/records/".$del_match_id."/matches/chosen" =>
PUT => "/api/v1/import_batches/".$del_import_batch_id."/records/".$del_match_id."/matches/chosen" =>
json => {
candidate_match_id => $match_1->candidate_match_id
}
@ -94,7 +94,7 @@ subtest 'import record matches tests' => sub {
# Valid, authorised update
$tx = $t->ua->build_tx(
PUT => "/api/v1/import/".$match_1->import_record->import_batch_id."/records/".$match_1->import_record_id."/matches/chosen" =>
PUT => "/api/v1/import_batches/".$match_1->import_record->import_batch_id."/records/".$match_1->import_record_id."/matches/chosen" =>
json => {
candidate_match_id => $match_1->candidate_match_id
}
@ -111,7 +111,7 @@ subtest 'import record matches tests' => sub {
# Valid unsetting
$tx = $t->ua->build_tx(
DELETE => "/api/v1/import/".$match_1->import_record->import_batch_id."/records/".$match_1->import_record_id."/matches/chosen" =>
DELETE => "/api/v1/import_batches/".$match_1->import_record->import_batch_id."/records/".$match_1->import_record_id."/matches/chosen" =>
json => {
}
);