Bugzilla – Attachment 152438 Details for
Bug 33036
REST API: Merge biblio records
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33036: REST API: Merge biblio records
infrastructure-f-merge-api.patch (text/plain), 3.86 KB, created by
Mark Hofstetter
on 2023-06-16 16:39:07 UTC
(
hide
)
Description:
Bug 33036: REST API: Merge biblio records
Filename:
MIME Type:
Creator:
Mark Hofstetter
Created:
2023-06-16 16:39:07 UTC
Size:
3.86 KB
patch
obsolete
>From 685f04a4416764f748a0b1cf0ebfb9f2fce2e4a6 Mon Sep 17 00:00:00 2001 >From: Mark Hofstetter <mark@hofstetter.at> >Date: Tue, 13 Jun 2023 17:32:28 +0200 >Subject: [PATCH] infrastructure f merge api > >https://bugs.koha-community.org/show_bug.cgi?id=33036 >--- > Koha/REST/V1/Biblios.pm | 23 +++++++++++++ > api/v1/swagger/paths/biblios_merge.yaml | 45 +++++++++++++++++++++++++ > api/v1/swagger/swagger.yaml | 2 ++ > 3 files changed, 70 insertions(+) > create mode 100644 api/v1/swagger/paths/biblios_merge.yaml > >diff --git a/Koha/REST/V1/Biblios.pm b/Koha/REST/V1/Biblios.pm >index 6457d49d7a..0c0a62a1e7 100644 >--- a/Koha/REST/V1/Biblios.pm >+++ b/Koha/REST/V1/Biblios.pm >@@ -859,4 +859,27 @@ sub list { > }; > } > >+sub merge { >+ my $c = shift->openapi->valid_input or return; >+ my $bn = $c->validation->param('biblio_id'); >+ my $bn_merge = $c->validation->param('biblio_id_to_merge'); >+ my $biblio = Koha::Biblios->find( $bn ); >+ if ( not defined $biblio ) { >+ return $c->render( >+ status => 404, >+ openapi => { error => sprintf("[%s] biblio to merge into not found", $bn) } >+ ); >+ } >+ >+ my $biblio_to_merge = Koha::Biblios->find( $bn_merge ); >+ if ( not defined $biblio_to_merge ) { >+ return $c->render( >+ status => 404, >+ openapi => { error => sprintf("[%s] biblio to merge from not found", $bn_merge) } >+ ); >+ } >+ >+ return $c->render( status => 200, openapi => sprintf("OK %s <= %s, %s, %s", $bn, $bn_merge, $biblio->title, $biblio_to_merge->title) ); >+} >+ > 1; >diff --git a/api/v1/swagger/paths/biblios_merge.yaml b/api/v1/swagger/paths/biblios_merge.yaml >new file mode 100644 >index 0000000000..867796eda1 >--- /dev/null >+++ b/api/v1/swagger/paths/biblios_merge.yaml >@@ -0,0 +1,45 @@ >+--- >+"/biblios/{biblio_id}/merge/{biblio_id_to_merge}": >+ put: >+ x-mojo-to: Biblios#merge >+ operationId: mergeBiblios >+ tags: >+ - merge_biblios >+ summary: Merge Biblios >+ parameters: >+ - name: biblio_id >+ in: path >+ description: Bilblionumber to be merged into >+ required: true >+ type: string >+ - name: biblio_id_to_merge >+ in: path >+ required: true >+ description: Biblionumber from which to merge >+ type: string >+ responses: >+ '200': >+ description: OK message >+## schema: >+## type: string >+## items: >+## "$ref": "../swagger.yaml#/definitions/item_group" >+## '401': >+## description: Authentication required >+## schema: >+## "$ref": "../swagger.yaml#/definitions/error" >+## '403': >+## description: Access forbidden >+## schema: >+## "$ref": "../swagger.yaml#/definitions/error" >+## '500': >+## description: Internal server error >+## schema: >+## "$ref": "../swagger.yaml#/definitions/error" >+## '503': >+## description: Under maintenance >+## schema: >+## "$ref": "../swagger.yaml#/definitions/error" >+ x-koha-authorization: >+ permissions: >+ catalogue: "manage_item_groups" >diff --git a/api/v1/swagger/swagger.yaml b/api/v1/swagger/swagger.yaml >index 9e60aa77a2..d32fc45551 100644 >--- a/api/v1/swagger/swagger.yaml >+++ b/api/v1/swagger/swagger.yaml >@@ -183,6 +183,8 @@ paths: > $ref: "./paths/biblios_item_groups.yaml#/~1biblios~1{biblio_id}~1item_groups~1{item_group_id}~1items" > "/biblios/{biblio_id}/item_groups/{item_group_id}/items/{item_id}": > $ref: "./paths/biblios_item_groups.yaml#/~1biblios~1{biblio_id}~1item_groups~1{item_group_id}~1items~1{item_id}" >+ "/biblios/{biblio_id}/merge/{biblio_id_to_merge}": >+ $ref: "./paths/biblios_merge.yaml#/~1biblios~1{biblio_id}~1merge~1{biblio_id_to_merge}" > "/cash_registers/{cash_register_id}/cashups": > $ref: "./paths/cash_registers.yaml#/~1cash_registers~1{cash_register_id}~1cashups" > "/cashups/{cashup_id}": >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 33036
:
152436
|
152437
|
152438
|
152439
|
152440
|
152447
|
152472
|
152659
|
152678
|
157481
|
157482
|
157731
|
159011
|
159012
|
159103
|
159120
|
159191
|
159239
|
159826
|
159827
|
159828
|
159829
|
160302
|
160468
|
160469
|
160470
|
160471
|
160472