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

(-)a/api/v1/swagger/paths.json (+4 lines)
Lines 53-58 Link Here
53
  "/patrons/{patron_id}/account/credits": {
53
  "/patrons/{patron_id}/account/credits": {
54
    "$ref": "paths/patrons_account.json#/~1patrons~1{patron_id}~1account~1credits"
54
    "$ref": "paths/patrons_account.json#/~1patrons~1{patron_id}~1account~1credits"
55
  },
55
  },
56
  "/patrons/{patron_id}/checkouts": {
57
    "$ref": "paths/checkouts.json#/~1patrons~1{patron_id}~1checkouts"
58
  },
59
56
  "/patrons/{patron_id}/password": {
60
  "/patrons/{patron_id}/password": {
57
    "$ref": "paths/patrons_password.json#/~1patrons~1{patron_id}~1password"
61
    "$ref": "paths/patrons_password.json#/~1patrons~1{patron_id}~1password"
58
  },
62
  },
(-)a/api/v1/swagger/paths/checkouts.json (+39 lines)
Lines 97-101 Link Here
97
        }
97
        }
98
      }
98
      }
99
    }
99
    }
100
  },
101
  "/patrons/{patron_id}/checkouts": {
102
    "get": {
103
      "x-mojo-to": "Checkouts#list",
104
      "operationId": "listPatronsCheckouts",
105
      "tags": ["patrons", "checkouts"],
106
      "parameters": [{
107
        "$ref": "../parameters.json#/patron_id_pp"
108
      },{
109
        "name": "checked_in",
110
        "in": "query",
111
        "description": "By default, only current checkout are returned, when this is true, all checkouts (current and checked in) are returned as result.",
112
        "type": "boolean"
113
      }],
114
      "produces": [
115
        "application/json"
116
      ],
117
      "responses": {
118
        "200": {
119
          "description": "A list of checkouts",
120
          "schema": {
121
            "$ref": "../definitions.json#/checkouts"
122
          }
123
        },
124
        "403": {
125
          "description": "Access forbidden",
126
          "schema": { "$ref": "../definitions.json#/error" }
127
        },
128
        "404": {
129
          "description": "Patron not found",
130
          "schema": { "$ref": "../definitions.json#/error" }
131
        }
132
      },
133
      "x-koha-authorization": {
134
        "permissions": {
135
          "circulate": "circulate_remaining_permissions"
136
        }
137
      }
138
    }
100
  }
139
  }
101
}
140
}
(-)a/t/db_dependent/api/v1/checkouts.t (-2 / +11 lines)
Lines 17-23 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 67;
20
use Test::More tests => 76;
21
use Test::MockModule;
21
use Test::MockModule;
22
use Test::Mojo;
22
use Test::Mojo;
23
use t::lib::Mocks;
23
use t::lib::Mocks;
Lines 130-135 $t->get_ok( "//$userid:$password@/api/v1/checkouts?patron_id=$patron_id") Link Here
130
  ->json_is('/1/due_date' => output_pref({ dateformat => "rfc3339", dt => $date_due2 }) )
130
  ->json_is('/1/due_date' => output_pref({ dateformat => "rfc3339", dt => $date_due2 }) )
131
  ->json_hasnt('/2');
131
  ->json_hasnt('/2');
132
132
133
$t->get_ok( "//$userid:$password@/api/v1/patrons/$patron_id/checkouts")
134
  ->status_is(200)
135
  ->json_is('/0/patron_id' => $patron_id)
136
  ->json_is('/0/item_id' => $item1->itemnumber)
137
  ->json_is('/0/due_date' => output_pref({ dateformat => "rfc3339", dt => $date_due1 }) )
138
  ->json_is('/1/patron_id' => $patron_id)
139
  ->json_is('/1/item_id' => $item2->itemnumber)
140
  ->json_is('/1/due_date' => output_pref({ dateformat => "rfc3339", dt => $date_due2 }) )
141
  ->json_hasnt('/2');
142
133
$t->get_ok( "//$userid:$password@/api/v1/checkouts/" . $issue1->issue_id)
143
$t->get_ok( "//$userid:$password@/api/v1/checkouts/" . $issue1->issue_id)
134
  ->status_is(200)
144
  ->status_is(200)
135
  ->json_is('/patron_id' => $patron_id)
145
  ->json_is('/patron_id' => $patron_id)
136
- 

Return to bug 22613