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

(-)a/Koha/REST/V1/Bookings.pm (-1 / +1 lines)
Lines 93-99 sub add { Link Here
93
            );
93
            );
94
        } elsif ( blessed $_ and $_->isa('Koha::Exceptions::Object::DuplicateID') ) {
94
        } elsif ( blessed $_ and $_->isa('Koha::Exceptions::Object::DuplicateID') ) {
95
            return $c->render(
95
            return $c->render(
96
                status  => 400,
96
                status  => 409,
97
                openapi => {
97
                openapi => {
98
                    error => "Duplicate booking_id",
98
                    error => "Duplicate booking_id",
99
                }
99
                }
(-)a/api/v1/swagger/paths/bookings.yaml (+4 lines)
Lines 102-107 Link Here
102
        description: Access forbidden
102
        description: Access forbidden
103
        schema:
103
        schema:
104
          $ref: ../swagger.yaml#/definitions/error
104
          $ref: ../swagger.yaml#/definitions/error
105
      409:
106
        description: Conflict
107
        schema:
108
          $ref: ../swagger.yaml#/definitions/error
105
      500:
109
      500:
106
        description: Internal error
110
        description: Internal error
107
        schema:
111
        schema:
(-)a/t/db_dependent/api/v1/bookings.t (-2 / +1 lines)
Lines 262-268 subtest 'add() tests' => sub { Link Here
262
262
263
    # Authorized attempt to create with existing id
263
    # Authorized attempt to create with existing id
264
    $booking->{booking_id} = $booking_id;
264
    $booking->{booking_id} = $booking_id;
265
    $t->post_ok( "//$userid:$password@/api/v1/bookings" => json => $booking )->status_is(400)
265
    $t->post_ok( "//$userid:$password@/api/v1/bookings" => json => $booking )->status_is(409)
266
        ->json_is( "/error" => "Duplicate booking_id" );
266
        ->json_is( "/error" => "Duplicate booking_id" );
267
267
268
    # TODO: Test bookings clashes
268
    # TODO: Test bookings clashes
269
- 

Return to bug 36100