Bugzilla – Attachment 189124 Details for
Bug 29668
Add API route to create a basket
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29668: Adapt to current guidelines
aafd9c1.patch (text/plain), 1.88 KB, created by
Tomás Cohen Arazi (tcohen)
on 2025-11-05 16:51:17 UTC
(
hide
)
Description:
Bug 29668: Adapt to current guidelines
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2025-11-05 16:51:17 UTC
Size:
1.88 KB
patch
obsolete
>From aafd9c14e2cd445193b7b504af196e6d604aeba4 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Tom=C3=A1s=20Cohen=20Arazi?= <tomascohen@theke.io> >Date: Wed, 5 Nov 2025 13:49:36 -0300 >Subject: [PATCH] Bug 29668: Adapt to current guidelines >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >The added patches make some changes: > >* $c->req->json is used to access the request body, as explained by the > Mojolicious OpenAPI plugin author it should be done. >* Instead of calling `$basket->to_api` we use the `$c->objects->to_api` > helper which deals with calling context (embeds, etc). Otherwise it > would require doing it manually if embeds are added. >* Tests are grouped together the same way the rest of them are. > >To test: >1. Apply this patches >2. Run: > $ ktd --shell > k$ prove t/db_dependent/api/v1/acquisitions_baskets.t >=> SUCCESS: Tests pass! > >Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io> >--- > Koha/REST/V1/Acquisitions/Baskets.pm | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > >diff --git a/Koha/REST/V1/Acquisitions/Baskets.pm b/Koha/REST/V1/Acquisitions/Baskets.pm >index f1f126d980e..708b9b7cbc0 100644 >--- a/Koha/REST/V1/Acquisitions/Baskets.pm >+++ b/Koha/REST/V1/Acquisitions/Baskets.pm >@@ -43,14 +43,14 @@ sub add { > my $c = shift->openapi->valid_input or return; > > return try { >- my $basket = Koha::Acquisition::Basket->new_from_api( $c->validation->param('body') ); >- $basket->store->discard_changes; >+ my $basket = Koha::Acquisition::Basket->new_from_api( $c->req->json ); >+ $basket->store; > > $c->res->headers->location( $c->req->url->to_string . '/' . $basket->basketno ); > > return $c->render( > status => 201, >- openapi => $basket->to_api >+ openapi => $c->objects->to_api($basket), > ); > } catch { > $c->unhandled_exception($_); >-- >2.51.2 >
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 29668
:
128371
|
183072
|
183073
|
183074
|
189122
|
189123
|
189124
|
189227
|
189228
|
189229