Bugzilla – Attachment 171645 Details for
Bug 37592
Add a record of creation and modification to bookings
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37592: (QA follow-up) Fetch database fields for api return
Bug-37592-QA-follow-up-Fetch-database-fields-for-a.patch (text/plain), 2.09 KB, created by
Martin Renvoize (ashimema)
on 2024-09-18 04:01:24 UTC
(
hide
)
Description:
Bug 37592: (QA follow-up) Fetch database fields for api return
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-09-18 04:01:24 UTC
Size:
2.09 KB
patch
obsolete
>From 90ba1c1bfe765146c04dfc4e3255dbebd3606ea5 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Wed, 18 Sep 2024 04:59:27 +0100 >Subject: [PATCH] Bug 37592: (QA follow-up) Fetch database fields for api > return > >Creation and Modification times are maintained by the database, but on >add/update we were not fetching the updated fields from the database for >the api response. > >This patch corrects that and also updates the api schema to reflect that >these are readOnly fields. > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > Koha/REST/V1/Bookings.pm | 2 ++ > api/v1/swagger/definitions/booking.yaml | 2 ++ > 2 files changed, 4 insertions(+) > >diff --git a/Koha/REST/V1/Bookings.pm b/Koha/REST/V1/Bookings.pm >index 44e381ef1b9..945614cd900 100644 >--- a/Koha/REST/V1/Bookings.pm >+++ b/Koha/REST/V1/Bookings.pm >@@ -77,6 +77,7 @@ sub add { > return try { > my $booking = Koha::Booking->new_from_api( $c->req->json ); > $booking->store; >+ $booking->discard_changes; > $c->res->headers->location( $c->req->url->to_string . '/' . $booking->booking_id ); > return $c->render( > status => 201, >@@ -118,6 +119,7 @@ sub update { > return try { > $booking->set_from_api( $c->req->json ); > $booking->store(); >+ $booking->discard_changes; > return $c->render( status => 200, openapi => $c->objects->to_api($booking) ); > } catch { > $c->unhandled_exception($_); >diff --git a/api/v1/swagger/definitions/booking.yaml b/api/v1/swagger/definitions/booking.yaml >index 34a4ab2852d..b40330dcd5b 100644 >--- a/api/v1/swagger/definitions/booking.yaml >+++ b/api/v1/swagger/definitions/booking.yaml >@@ -12,6 +12,7 @@ properties: > type: integer > creation_date: > description: Creation date and time of this booking >+ readOnly: true > format: date-time > type: string > end_date: >@@ -30,6 +31,7 @@ properties: > - 'null' > modification_date: > description: Modification date and time of this booking >+ readOnly: true > format: date-time > type: string > patron_id: >-- >2.46.0
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 37592
:
170144
|
170161
|
170763
|
171254
|
171376
|
171377
|
171378
|
171524
| 171645