View | Details | Raw Unified | Return to bug 36100
Collapse All | Expand All

(-)a/Koha/REST/V1/Bookings.pm (-1 / +8 lines)
Lines 83-89 sub add { Link Here
83
        $c->res->headers->location( $c->req->url->to_string . '/' . $booking->booking_id );
83
        $c->res->headers->location( $c->req->url->to_string . '/' . $booking->booking_id );
84
        return $c->render(
84
        return $c->render(
85
            status  => 201,
85
            status  => 201,
86
            openapi => $c->objects->to_api( $booking ),
86
            openapi => $c->objects->to_api($booking),
87
        );
87
        );
88
    } catch {
88
    } catch {
89
        if ( blessed $_ and $_->isa('Koha::Exceptions::Booking::Clash') ) {
89
        if ( blessed $_ and $_->isa('Koha::Exceptions::Booking::Clash') ) {
Lines 91-96 sub add { Link Here
91
                status  => 400,
91
                status  => 400,
92
                openapi => { error => "Booking would conflict" }
92
                openapi => { error => "Booking would conflict" }
93
            );
93
            );
94
        } elsif ( blessed $_ and $_->isa('Koha::Exceptions::Object::DuplicateID') ) {
95
            return $c->render(
96
                status  => 400,
97
                openapi => {
98
                    error => "Duplicate booking_id",
99
                }
100
            );
94
        }
101
        }
95
102
96
        return $c->unhandled_exception($_);
103
        return $c->unhandled_exception($_);
(-)a/api/v1/swagger/definitions/booking.yaml (-2 lines)
Lines 10-16 properties: Link Here
10
  booking_id:
10
  booking_id:
11
    description: Internal booking identifier
11
    description: Internal booking identifier
12
    type: integer
12
    type: integer
13
    readOnly: true
14
  end_date:
13
  end_date:
15
    description: Start date and time of this booking
14
    description: Start date and time of this booking
16
    format: date-time
15
    format: date-time
17
- 

Return to bug 36100