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

(-)a/Koha/REST/V1/Auth.pm (-4 / +5 lines)
Lines 254-260 sub check_object_ownership { Link Here
254
254
255
    my $parameters = {
255
    my $parameters = {
256
        accountlines_id => \&_object_ownership_by_accountlines_id,
256
        accountlines_id => \&_object_ownership_by_accountlines_id,
257
        borrowernumber  => \&_object_ownership_by_borrowernumber,
257
        borrowernumber  => \&_object_ownership_by_patron_id,
258
        patron_id       => \&_object_ownership_by_patron_id,
258
        checkout_id     => \&_object_ownership_by_checkout_id,
259
        checkout_id     => \&_object_ownership_by_checkout_id,
259
        reserve_id      => \&_object_ownership_by_reserve_id,
260
        reserve_id      => \&_object_ownership_by_reserve_id,
260
    };
261
    };
Lines 296-305 Compares C<$borrowernumber> to currently logged in C<$user>. Link Here
296
297
297
=cut
298
=cut
298
299
299
sub _object_ownership_by_borrowernumber {
300
sub _object_ownership_by_patron_id {
300
    my ($c, $user, $borrowernumber) = @_;
301
    my ($c, $user, $patron_id) = @_;
301
302
302
    return $user->borrowernumber == $borrowernumber;
303
    return $user->borrowernumber == $patron_id;
303
}
304
}
304
305
305
=head3 _object_ownership_by_checkout_id
306
=head3 _object_ownership_by_checkout_id
(-)a/Koha/REST/V1/Patrons.pm (-27 / +236 lines)
Lines 43-56 sub list { Link Here
43
    my $c = shift->openapi->valid_input or return;
43
    my $c = shift->openapi->valid_input or return;
44
44
45
    return try {
45
    return try {
46
        my $patrons_set = Koha::Patrons->new;
46
        my $attributes = {};
47
        my $patrons = $c->objects->search( $patrons_set );
47
        my $args = $c->validation->output;
48
        return $c->render( status => 200, openapi => $patrons );
48
        my ( $params, $reserved_params ) = $c->extract_reserved_params( $args );
49
50
        # Merge sorting into query attributes
51
        $c->dbic_merge_sorting({ attributes => $attributes, params => $reserved_params });
52
53
        # Merge pagination into query attributes
54
        $c->dbic_merge_pagination({ filter => $attributes, params => $reserved_params });
55
56
        my $restricted = $args->{restricted};
57
58
        $params = _to_model($params)
59
            if defined $params;
60
        # deal with string params
61
        $params = $c->build_query_params( $params, $reserved_params );
62
63
        # translate 'restricted' => 'debarred'
64
        $params->{debarred} = { '!=' => undef }
65
          if $restricted;
66
67
        my $patrons = Koha::Patrons->search( $params, $attributes );
68
        if ( $patrons->is_paged ) {
69
            $c->add_pagination_headers(
70
                {
71
                    total  => $patrons->pager->total_entries,
72
                    params => $args,
73
                }
74
            );
75
        }
76
        my @patrons = $patrons->as_list;
77
        @patrons = map { _to_api( $_->TO_JSON ) } @patrons;
78
        return $c->render( status => 200, openapi => \@patrons );
49
    }
79
    }
50
    catch {
80
    catch {
51
        if ( $_->isa('DBIx::Class::Exception') ) {
81
        if ( $_->isa('DBIx::Class::Exception') ) {
52
            return $c->render( status => 500,
82
            return $c->render(
53
                openapi => { error => $_->{msg} } );
83
                status  => 500,
84
                openapi => { error => $_->{msg} }
85
            );
54
        }
86
        }
55
        else {
87
        else {
56
            return $c->render(
88
            return $c->render(
Lines 61-66 sub list { Link Here
61
    };
93
    };
62
}
94
}
63
95
96
64
=head3 get
97
=head3 get
65
98
66
Controller function that handles retrieving a single Koha::Patron object
99
Controller function that handles retrieving a single Koha::Patron object
Lines 70-83 Controller function that handles retrieving a single Koha::Patron object Link Here
70
sub get {
103
sub get {
71
    my $c = shift->openapi->valid_input or return;
104
    my $c = shift->openapi->valid_input or return;
72
105
73
    my $borrowernumber = $c->validation->param('borrowernumber');
106
    my $patron_id = $c->validation->param('patron_id');
74
    my $patron = Koha::Patrons->find($borrowernumber);
107
    my $patron    = Koha::Patrons->find($patron_id);
75
108
76
    unless ($patron) {
109
    unless ($patron) {
77
        return $c->render(status => 404, openapi => { error => "Patron not found." });
110
        return $c->render( status => 404, openapi => { error => "Patron not found." } );
78
    }
111
    }
79
112
80
    return $c->render(status => 200, openapi => $patron);
113
    return $c->render( status => 200, openapi => _to_api( $patron->TO_JSON ) );
81
}
114
}
82
115
83
=head3 add
116
=head3 add
Lines 91-101 sub add { Link Here
91
124
92
    return try {
125
    return try {
93
126
94
        my $body = _to_model($c->validation->param('body'));
127
        my $body = _to_model( $c->validation->param('body') );
95
128
96
        # TODO: Use AddMember until it has been moved to Koha-namespace
129
        # TODO: Use AddMember until it has been moved to Koha-namespace
97
        my $borrowernumber = AddMember(%$body);
130
        my $patron_id = AddMember( %{ _to_model($body) } );
98
        my $patron         = Koha::Patrons->find($borrowernumber);
131
        my $patron    = _to_api( Koha::Patrons->find($patron_id)->TO_JSON );
99
132
100
        return $c->render( status => 201, openapi => $patron );
133
        return $c->render( status => 201, openapi => $patron );
101
    }
134
    }
Lines 103-111 sub add { Link Here
103
        unless ( blessed $_ && $_->can('rethrow') ) {
136
        unless ( blessed $_ && $_->can('rethrow') ) {
104
            return $c->render(
137
            return $c->render(
105
                status  => 500,
138
                status  => 500,
106
                openapi => {
139
                openapi => { error => "Something went wrong, check Koha logs for details." }
107
                    error => "Something went wrong, check Koha logs for details."
108
                }
109
            );
140
            );
110
        }
141
        }
111
        if ( $_->isa('Koha::Exceptions::Object::DuplicateID') ) {
142
        if ( $_->isa('Koha::Exceptions::Object::DuplicateID') ) {
Lines 117-142 sub add { Link Here
117
        elsif ( $_->isa('Koha::Exceptions::Object::FKConstraint') ) {
148
        elsif ( $_->isa('Koha::Exceptions::Object::FKConstraint') ) {
118
            return $c->render(
149
            return $c->render(
119
                status  => 400,
150
                status  => 400,
120
                openapi => { error => "Given " . $_->broken_fk . " does not exist" }
151
                openapi => {
152
                          error => "Given "
153
                        . $Koha::REST::V1::Patrons::to_api_mapping->{ $_->broken_fk }
154
                        . " does not exist"
155
                }
121
            );
156
            );
122
        }
157
        }
123
        elsif ( $_->isa('Koha::Exceptions::BadParameter') ) {
158
        elsif ( $_->isa('Koha::Exceptions::BadParameter') ) {
124
            return $c->render(
159
            return $c->render(
125
                status  => 400,
160
                status  => 400,
126
                openapi => { error => "Given " . $_->parameter . " does not exist" }
161
                openapi => {
162
                          error => "Given "
163
                        . $Koha::REST::V1::Patrons::to_api_mapping->{ $_->parameter }
164
                        . " does not exist"
165
                }
127
            );
166
            );
128
        }
167
        }
129
        else {
168
        else {
130
            return $c->render(
169
            return $c->render(
131
                status  => 500,
170
                status  => 500,
132
                openapi => {
171
                openapi => { error => "Something went wrong, check Koha logs for details." }
133
                    error => "Something went wrong, check Koha logs for details."
134
                }
135
            );
172
            );
136
        }
173
        }
137
    };
174
    };
138
}
175
}
139
176
177
140
=head3 update
178
=head3 update
141
179
142
Controller function that handles updating a Koha::Patron object
180
Controller function that handles updating a Koha::Patron object
Lines 146-152 Controller function that handles updating a Koha::Patron object Link Here
146
sub update {
184
sub update {
147
    my $c = shift->openapi->valid_input or return;
185
    my $c = shift->openapi->valid_input or return;
148
186
149
    my $patron_id = $c->validation->param('borrowernumber');
187
    my $patron_id = $c->validation->param('patron_id');
150
    my $patron    = Koha::Patrons->find( $patron_id );
188
    my $patron    = Koha::Patrons->find( $patron_id );
151
189
152
    unless ($patron) {
190
    unless ($patron) {
Lines 195-201 sub update { Link Here
195
        elsif ( $_->isa('Koha::Exceptions::Object::FKConstraint') ) {
233
        elsif ( $_->isa('Koha::Exceptions::Object::FKConstraint') ) {
196
            return $c->render(
234
            return $c->render(
197
                status  => 400,
235
                status  => 400,
198
                openapi => { error => "Given " . $_->broken_fk . " does not exist" }
236
                openapi => { error => "Given " .
237
                            $Koha::REST::V1::Patrons::to_api_mapping->{$_->broken_fk}
238
                            . " does not exist" }
199
            );
239
            );
200
        }
240
        }
201
        elsif ( $_->isa('Koha::Exceptions::MissingParameter') ) {
241
        elsif ( $_->isa('Koha::Exceptions::MissingParameter') ) {
Lines 246-252 sub delete { Link Here
246
    my $patron;
286
    my $patron;
247
287
248
    return try {
288
    return try {
249
        $patron = Koha::Patrons->find( $c->validation->param('borrowernumber') );
289
        $patron = Koha::Patrons->find( $c->validation->param('patron_id') );
250
290
251
        # check if loans, reservations, debarrment, etc. before deletion!
291
        # check if loans, reservations, debarrment, etc. before deletion!
252
        my $res = $patron->delete;
292
        my $res = $patron->delete;
Lines 271-276 sub delete { Link Here
271
    };
311
    };
272
}
312
}
273
313
314
=head3 _to_api
315
316
Helper function that maps unblessed Koha::Patron objects into REST api
317
attribute names.
318
319
=cut
320
321
sub _to_api {
322
    my $patron    = shift;
323
    my $patron_id = $patron->{ borrowernumber };
324
325
    # Rename attributes
326
    foreach my $column ( keys %{ $Koha::REST::V1::Patrons::to_api_mapping } ) {
327
        my $mapped_column = $Koha::REST::V1::Patrons::to_api_mapping->{$column};
328
        if (    exists $patron->{ $column }
329
             && defined $mapped_column )
330
        {
331
            # key != undef
332
            $patron->{ $mapped_column } = delete $patron->{ $column };
333
        }
334
        elsif (    exists $patron->{ $column }
335
                && !defined $mapped_column )
336
        {
337
            # key == undef
338
            delete $patron->{ $column };
339
        }
340
    }
341
342
    # Calculate the 'restricted' field
343
    my $patron_obj = Koha::Patrons->find( $patron_id );
344
    $patron->{ restricted } = ($patron_obj->is_debarred) ? Mojo::JSON->true : Mojo::JSON->false;
345
346
    return $patron;
347
}
348
274
=head3 _to_model
349
=head3 _to_model
275
350
276
Helper function that maps REST api objects into Koha::Patron
351
Helper function that maps REST api objects into Koha::Patron
Lines 279-290 attribute names. Link Here
279
=cut
354
=cut
280
355
281
sub _to_model {
356
sub _to_model {
282
    my $params = shift;
357
    my $patron = shift;
358
359
    foreach my $attribute ( keys %{ $Koha::REST::V1::Patrons::to_model_mapping } ) {
360
        my $mapped_attribute = $Koha::REST::V1::Patrons::to_model_mapping->{$attribute};
361
        if (    exists $patron->{ $attribute }
362
             && defined $mapped_attribute )
363
        {
364
            # key => !undef
365
            $patron->{ $mapped_attribute } = delete $patron->{ $attribute };
366
        }
367
        elsif (    exists $patron->{ $attribute }
368
                && !defined $mapped_attribute )
369
        {
370
            # key => undef / to be deleted
371
            delete $patron->{ $attribute };
372
        }
373
    }
374
375
    # TODO: Get rid of this once write operations are based on Koha::Patron
376
    if ( exists $patron->{lost} ) {
377
        $patron->{lost} = ($patron->{lost}) ? 1 : 0;
378
    }
283
379
284
    $params->{lost} = ($params->{lost}) ? 1 : 0;
380
    if ( exists $patron->{ gonenoaddress} ) {
285
    $params->{gonenoaddress} = ($params->{gonenoaddress}) ? 1 : 0;
381
        $patron->{gonenoaddress} = ($patron->{gonenoaddress}) ? 1 : 0;
382
    }
286
383
287
    return $params;
384
    return $patron;
288
}
385
}
289
386
387
=head2 Global variables
388
389
=head3 $to_api_mapping
390
391
=cut
392
393
our $to_api_mapping = {
394
    borrowernotes       => 'staff_notes',
395
    borrowernumber      => 'patron_id',
396
    branchcode          => 'library_id',
397
    categorycode        => 'category_id',
398
    checkprevcheckout   => 'check_previous_checkout',
399
    contactfirstname    => undef, # Unused
400
    contactname         => undef, # Unused
401
    contactnote         => 'altaddress_notes',
402
    contacttitle        => undef, # Unused
403
    dateenrolled        => 'date_enrolled',
404
    dateexpiry          => 'expiry_date',
405
    dateofbirth         => 'date_of_birth',
406
    debarred            => undef, # replaced by 'restricted'
407
    debarredcomment     => undef, # calculated, API consumers will use /restrictions instead
408
    emailpro            => 'secondary_email',
409
    flags               => undef, # permissions manipulation handled in /permissions
410
    gonenoaddress       => 'incorrect_address',
411
    guarantorid         => 'guarantor_id',
412
    lastseen            => 'last_seen',
413
    lost                => 'patron_card_lost',
414
    opacnote            => 'opac_notes',
415
    othernames          => 'other_name',
416
    password            => undef, # password manipulation handled in /password
417
    phonepro            => 'secondary_phone',
418
    relationship        => 'relationship_type',
419
    sex                 => 'gender',
420
    smsalertnumber      => 'sms_number',
421
    sort1               => 'statistics_1',
422
    sort2               => 'statistics_2',
423
    streetnumber        => 'street_number',
424
    streettype          => 'street_type',
425
    zipcode             => 'postal_code',
426
    B_address           => 'altaddress_address',
427
    B_address2          => 'altaddress_address2',
428
    B_city              => 'altaddress_city',
429
    B_country           => 'altaddress_country',
430
    B_email             => 'altaddress_email',
431
    B_phone             => 'altaddress_phone',
432
    B_state             => 'altaddress_state',
433
    B_streetnumber      => 'altaddress_street_number',
434
    B_streettype        => 'altaddress_street_type',
435
    B_zipcode           => 'altaddress_postal_code',
436
    altcontactaddress1  => 'altcontact_address',
437
    altcontactaddress2  => 'altcontact_address2',
438
    altcontactaddress3  => 'altcontact_city',
439
    altcontactcountry   => 'altcontact_country',
440
    altcontactfirstname => 'altcontact_firstname',
441
    altcontactphone     => 'altcontact_phone',
442
    altcontactsurname   => 'altcontact_surname',
443
    altcontactstate     => 'altcontact_state',
444
    altcontactzipcode   => 'altcontact_postal_code'
445
};
446
447
=head3 $to_model_mapping
448
449
=cut
450
451
our $to_model_mapping = {
452
    altaddress_notes         => 'contactnote',
453
    category_id              => 'categorycode',
454
    check_previous_checkout  => 'checkprevcheckout',
455
    date_enrolled            => 'dateenrolled',
456
    date_of_birth            => 'dateofbirth',
457
    expiry_date              => 'dateexpiry',
458
    gender                   => 'sex',
459
    guarantor_id             => 'guarantorid',
460
    incorrect_address        => 'gonenoaddress',
461
    last_seen                => 'lastseen',
462
    library_id               => 'branchcode',
463
    opac_notes               => 'opacnote',
464
    other_name               => 'othernames',
465
    patron_card_lost         => 'lost',
466
    patron_id                => 'borrowernumber',
467
    postal_code              => 'zipcode',
468
    relationship_type        => 'relationship',
469
    restricted               => undef,
470
    secondary_email          => 'emailpro',
471
    secondary_phone          => 'phonepro',
472
    sms_number               => 'smsalertnumber',
473
    staff_notes              => 'borrowernotes',
474
    statistics_1             => 'sort1',
475
    statistics_2             => 'sort2',
476
    street_number            => 'streetnumber',
477
    street_type              => 'streettype',
478
    altaddress_address       => 'B_address',
479
    altaddress_address2      => 'B_address2',
480
    altaddress_city          => 'B_city',
481
    altaddress_country       => 'B_country',
482
    altaddress_email         => 'B_email',
483
    altaddress_phone         => 'B_phone',
484
    altaddress_state         => 'B_state',
485
    altaddress_street_number => 'B_streetnumber',
486
    altaddress_street_type   => 'B_streettype',
487
    altaddress_postal_code   => 'B_zipcode',
488
    altcontact_firstname     => 'altcontactfirstname',
489
    altcontact_surname       => 'altcontactsurname',
490
    altcontact_address       => 'altcontactaddress1',
491
    altcontact_address2      => 'altcontactaddress2',
492
    altcontact_city          => 'altcontactaddress3',
493
    altcontact_state         => 'altcontactstate',
494
    altcontact_postal_code   => 'altcontactzipcode',
495
    altcontact_country       => 'altcontactcountry',
496
    altcontact_phone         => 'altcontactphone'
497
};
498
290
1;
499
1;
(-)a/api/v1/swagger/definitions/patron.json (-77 / +53 lines)
Lines 1-8 Link Here
1
{
1
{
2
  "type": "object",
2
  "type": "object",
3
  "properties": {
3
  "properties": {
4
    "borrowernumber": {
4
    "patron_id": {
5
      "$ref": "../x-primitives.json#/borrowernumber"
5
      "$ref": "../x-primitives.json#/patron_id"
6
    },
6
    },
7
    "cardnumber": {
7
    "cardnumber": {
8
      "$ref": "../x-primitives.json#/cardnumber"
8
      "$ref": "../x-primitives.json#/cardnumber"
Lines 17-23 Link Here
17
      "type": ["string", "null"],
17
      "type": ["string", "null"],
18
      "description": "patron's title"
18
      "description": "patron's title"
19
    },
19
    },
20
    "othernames": {
20
    "other_name": {
21
      "type": ["string", "null"],
21
      "type": ["string", "null"],
22
      "description": "any other names associated with the patron"
22
      "description": "any other names associated with the patron"
23
    },
23
    },
Lines 25-35 Link Here
25
      "type": ["string", "null"],
25
      "type": ["string", "null"],
26
      "description": "initials of the patron"
26
      "description": "initials of the patron"
27
    },
27
    },
28
    "streetnumber": {
28
    "street_number": {
29
      "type": ["string", "null"],
29
      "type": ["string", "null"],
30
      "description": "street number of patron's primary address"
30
      "description": "street number of patron's primary address"
31
    },
31
    },
32
    "streettype": {
32
    "street_type": {
33
      "type": ["string", "null"],
33
      "type": ["string", "null"],
34
      "description": "street type of patron's primary address"
34
      "description": "street type of patron's primary address"
35
    },
35
    },
Lines 49-55 Link Here
49
      "type": ["string", "null"],
49
      "type": ["string", "null"],
50
      "description": "state or province of patron's primary address"
50
      "description": "state or province of patron's primary address"
51
    },
51
    },
52
    "zipcode": {
52
    "postal_code": {
53
      "type": ["string", "null"],
53
      "type": ["string", "null"],
54
      "description": "zip or postal code of patron's primary address"
54
      "description": "zip or postal code of patron's primary address"
55
    },
55
    },
Lines 71-143 Link Here
71
      "type": ["string", "null"],
71
      "type": ["string", "null"],
72
      "description": "fax number for patron's primary address"
72
      "description": "fax number for patron's primary address"
73
    },
73
    },
74
    "emailpro": {
74
    "secondary_email": {
75
      "type": ["string", "null"],
75
      "type": ["string", "null"],
76
      "description": "secondary email address for patron's primary address"
76
      "description": "secondary email address for patron's primary address"
77
    },
77
    },
78
    "phonepro": {
78
    "secondary_phone": {
79
      "type": ["string", "null"],
79
      "type": ["string", "null"],
80
      "description": "secondary phone number for patron's primary address"
80
      "description": "secondary phone number for patron's primary address"
81
    },
81
    },
82
    "B_streetnumber": {
82
    "altaddress_street_number": {
83
      "type": ["string", "null"],
83
      "type": ["string", "null"],
84
      "description": "street number of patron's alternate address"
84
      "description": "street number of patron's alternate address"
85
    },
85
    },
86
    "B_streettype": {
86
    "altaddress_street_type": {
87
      "type": ["string", "null"],
87
      "type": ["string", "null"],
88
      "description": "street type of patron's alternate address"
88
      "description": "street type of patron's alternate address"
89
    },
89
    },
90
    "B_address": {
90
    "altaddress_address": {
91
      "type": ["string", "null"],
91
      "type": ["string", "null"],
92
      "description": "first address line of patron's alternate address"
92
      "description": "first address line of patron's alternate address"
93
    },
93
    },
94
    "B_address2": {
94
    "altaddress_address2": {
95
      "type": ["string", "null"],
95
      "type": ["string", "null"],
96
      "description": "second address line of patron's alternate address"
96
      "description": "second address line of patron's alternate address"
97
    },
97
    },
98
    "B_city": {
98
    "altaddress_city": {
99
      "type": ["string", "null"],
99
      "type": ["string", "null"],
100
      "description": "city or town of patron's alternate address"
100
      "description": "city or town of patron's alternate address"
101
    },
101
    },
102
    "B_state": {
102
    "altaddress_state": {
103
      "type": ["string", "null"],
103
      "type": ["string", "null"],
104
      "description": "state or province of patron's alternate address"
104
      "description": "state or province of patron's alternate address"
105
    },
105
    },
106
    "B_zipcode": {
106
    "altaddress_postal_code": {
107
      "type": ["string", "null"],
107
      "type": ["string", "null"],
108
      "description": "zip or postal code of patron's alternate address"
108
      "description": "zip or postal code of patron's alternate address"
109
    },
109
    },
110
    "B_country": {
110
    "altaddress_country": {
111
      "type": ["string", "null"],
111
      "type": ["string", "null"],
112
      "description": "country of patron's alternate address"
112
      "description": "country of patron's alternate address"
113
    },
113
    },
114
    "B_email": {
114
    "altaddress_email": {
115
      "type": ["string", "null"],
115
      "type": ["string", "null"],
116
      "description": "email address for patron's alternate address"
116
      "description": "email address for patron's alternate address"
117
    },
117
    },
118
    "B_phone": {
118
    "altaddress_phone": {
119
      "type": ["string", "null"],
119
      "type": ["string", "null"],
120
      "description": "phone number for patron's alternate address"
120
      "description": "phone number for patron's alternate address"
121
    },
121
    },
122
    "dateofbirth": {
122
    "date_of_birth": {
123
      "type": ["string", "null"],
123
      "type": ["string", "null"],
124
      "format": "date",
124
      "format": "date",
125
      "description": "patron's date of birth"
125
      "description": "patron's date of birth"
126
    },
126
    },
127
    "branchcode": {
127
    "library_id": {
128
      "type": "string",
128
      "type": "string",
129
      "description": "code of patron's home branch"
129
      "description": "Internal identifier for the patron's home library"
130
    },
130
    },
131
    "categorycode": {
131
    "category_id": {
132
      "type": "string",
132
      "type": "string",
133
      "description": "code of patron's category"
133
      "description": "Internal identifier for the patron's category"
134
    },
134
    },
135
    "dateenrolled": {
135
    "date_enrolled": {
136
      "type": ["string", "null"],
136
      "type": ["string", "null"],
137
      "format": "date",
137
      "format": "date",
138
      "description": "date the patron was added to Koha"
138
      "description": "date the patron was added to Koha"
139
    },
139
    },
140
    "dateexpiry": {
140
    "expiry_date": {
141
      "type": ["string", "null"],
141
      "type": ["string", "null"],
142
      "format": "date",
142
      "format": "date",
143
      "description": "date the patron's card is set to expire"
143
      "description": "date the patron's card is set to expire"
Lines 146-261 Link Here
146
      "type": ["string", "null"],
146
      "type": ["string", "null"],
147
      "description": "date the patron's card was last renewed"
147
      "description": "date the patron's card was last renewed"
148
    },
148
    },
149
    "gonenoaddress": {
149
    "incorrect_address": {
150
      "type": ["boolean", "null"],
150
      "type": ["boolean", "null"],
151
      "description": "set to 1 if library marked this patron as having an unconfirmed address"
151
      "description": "set to 1 if library marked this patron as having an unconfirmed address"
152
    },
152
    },
153
    "lost": {
153
    "patron_card_lost": {
154
      "type": ["boolean", "null"],
154
      "type": ["boolean", "null"],
155
      "description": "set to 1 if library marked this patron as having lost his card"
155
      "description": "set to 1 if library marked this patron as having lost his card"
156
    },
156
    },
157
    "debarred": {
157
    "restricted": {
158
      "type": ["string", "null"],
158
      "type": "boolean",
159
      "format": "date",
159
      "readOnly": true,
160
      "description": "until this date the patron can only check-in"
160
      "description": "If any restriction applies to the patron"
161
    },
162
    "debarredcomment": {
163
      "type": ["string", "null"],
164
      "description": "comment on the stop of the patron"
165
    },
166
    "contactname": {
167
      "type": ["string", "null"],
168
      "description": "used for children and professionals to include surname or last name of guarantor or organization name"
169
    },
170
    "contactfirstname": {
171
      "type": ["string", "null"],
172
      "description": "used for children to include first name of guarantor"
173
    },
174
    "contacttitle": {
175
      "type": ["string", "null"],
176
      "description": "used for children to include title of guarantor"
177
    },
161
    },
178
    "guarantorid": {
162
    "guarantor_id": {
179
      "type": ["integer", "null"],
163
      "type": ["integer", "null"],
180
      "description": "borrowernumber used for children or professionals to link them to guarantor or organizations"
164
      "description": "patron_id used for children or professionals to link them to guarantor or organizations"
181
    },
165
    },
182
    "borrowernotes": {
166
    "staff_notes": {
183
      "type": ["string", "null"],
167
      "type": ["string", "null"],
184
      "description": "a note on the patron's account"
168
      "description": "a note on the patron's account"
185
    },
169
    },
186
    "relationship": {
170
    "relationship_type": {
187
      "type": ["string", "null"],
171
      "type": ["string", "null"],
188
      "description": "used for children to include the relationship to their guarantor"
172
      "description": "used for children to include the relationship to their guarantor"
189
    },
173
    },
190
    "sex": {
174
    "gender": {
191
      "type": ["string", "null"],
175
      "type": ["string", "null"],
192
      "description": "patron's gender"
176
      "description": "patron's gender"
193
    },
177
    },
194
    "password": {
195
      "type": ["string", "null"],
196
      "description": "patron's encrypted password"
197
    },
198
    "flags": {
199
      "type": ["integer", "null"],
200
      "description": "a number associated with the patron's permissions"
201
    },
202
    "userid": {
178
    "userid": {
203
      "type": ["string", "null"],
179
      "type": ["string", "null"],
204
      "description": "patron's login"
180
      "description": "patron's login"
205
    },
181
    },
206
    "opacnote": {
182
    "opac_notes": {
207
      "type": ["string", "null"],
183
      "type": ["string", "null"],
208
      "description": "a note on the patron's account visible in OPAC and staff client"
184
      "description": "a note on the patron's account visible in OPAC and staff client"
209
    },
185
    },
210
    "contactnote": {
186
    "altaddress_notes": {
211
      "type": ["string", "null"],
187
      "type": ["string", "null"],
212
      "description": "a note related to patron's alternate address"
188
      "description": "a note related to patron's alternate address"
213
    },
189
    },
214
    "sort1": {
190
    "statistics_1": {
215
      "type": ["string", "null"],
191
      "type": ["string", "null"],
216
      "description": "a field that can be used for any information unique to the library"
192
      "description": "a field that can be used for any information unique to the library"
217
    },
193
    },
218
    "sort2": {
194
    "statistics_2": {
219
      "type": ["string", "null"],
195
      "type": ["string", "null"],
220
      "description": "a field that can be used for any information unique to the library"
196
      "description": "a field that can be used for any information unique to the library"
221
    },
197
    },
222
    "altcontactfirstname": {
198
    "altcontact_firstname": {
223
      "type": ["string", "null"],
199
      "type": ["string", "null"],
224
      "description": "first name of alternate contact for the patron"
200
      "description": "first name of alternate contact for the patron"
225
    },
201
    },
226
    "altcontactsurname": {
202
    "altcontact_surname": {
227
      "type": ["string", "null"],
203
      "type": ["string", "null"],
228
      "description": "surname or last name of the alternate contact for the patron"
204
      "description": "surname or last name of the alternate contact for the patron"
229
    },
205
    },
230
    "altcontactaddress1": {
206
    "altcontact_address": {
231
      "type": ["string", "null"],
207
      "type": ["string", "null"],
232
      "description": "the first address line for the alternate contact for the patron"
208
      "description": "the first address line for the alternate contact for the patron"
233
    },
209
    },
234
    "altcontactaddress2": {
210
    "altcontact_address2": {
235
      "type": ["string", "null"],
211
      "type": ["string", "null"],
236
      "description": "the second address line for the alternate contact for the patron"
212
      "description": "the second address line for the alternate contact for the patron"
237
    },
213
    },
238
    "altcontactaddress3": {
214
    "altcontact_city": {
239
      "type": ["string", "null"],
215
      "type": ["string", "null"],
240
      "description": "the city for the alternate contact for the patron"
216
      "description": "the city for the alternate contact for the patron"
241
    },
217
    },
242
    "altcontactstate": {
218
    "altcontact_state": {
243
      "type": ["string", "null"],
219
      "type": ["string", "null"],
244
      "description": "the state for the alternate contact for the patron"
220
      "description": "the state for the alternate contact for the patron"
245
    },
221
    },
246
    "altcontactzipcode": {
222
    "altcontact_postal_code": {
247
      "type": ["string", "null"],
223
      "type": ["string", "null"],
248
      "description": "the zipcode for the alternate contact for the patron"
224
      "description": "the zipcode for the alternate contact for the patron"
249
    },
225
    },
250
    "altcontactcountry": {
226
    "altcontact_country": {
251
      "type": ["string", "null"],
227
      "type": ["string", "null"],
252
      "description": "the country for the alternate contact for the patron"
228
      "description": "the country for the alternate contact for the patron"
253
    },
229
    },
254
    "altcontactphone": {
230
    "altcontact_phone": {
255
      "type": ["string", "null"],
231
      "type": ["string", "null"],
256
      "description": "the phone number for the alternate contact for the patron"
232
      "description": "the phone number for the alternate contact for the patron"
257
    },
233
    },
258
    "smsalertnumber": {
234
    "sms_number": {
259
      "type": ["string", "null"],
235
      "type": ["string", "null"],
260
      "description": "the mobile phone number where the patron would like to receive notices (if SMS turned on)"
236
      "description": "the mobile phone number where the patron would like to receive notices (if SMS turned on)"
261
    },
237
    },
Lines 271-277 Link Here
271
      "type": "integer",
247
      "type": "integer",
272
      "description": "controls if relatives can see this patron's checkouts"
248
      "description": "controls if relatives can see this patron's checkouts"
273
    },
249
    },
274
    "checkprevcheckout": {
250
    "check_previous_checkout": {
275
      "type": "string",
251
      "type": "string",
276
      "description": "produce a warning for this patron if this item has previously been checked out to this patron if 'yes', not if 'no', defer to category setting if 'inherit'"
252
      "description": "produce a warning for this patron if this item has previously been checked out to this patron if 'yes', not if 'no', defer to category setting if 'inherit'"
277
    },
253
    },
Lines 280-286 Link Here
280
      "format": "date-time",
256
      "format": "date-time",
281
      "description": "time of last change could be useful for synchronization with external systems (among others)"
257
      "description": "time of last change could be useful for synchronization with external systems (among others)"
282
    },
258
    },
283
    "lastseen": {
259
    "last_seen": {
284
      "type": ["string", "null"],
260
      "type": ["string", "null"],
285
      "format": "date-time",
261
      "format": "date-time",
286
      "description": "last time a patron has been seen (connected at the OPAC or staff interface)"
262
      "description": "last time a patron has been seen (connected at the OPAC or staff interface)"
Lines 299-303 Link Here
299
    }
275
    }
300
  },
276
  },
301
  "additionalProperties": false,
277
  "additionalProperties": false,
302
  "required": ["surname", "address", "city", "branchcode", "categorycode"]
278
  "required": ["surname", "address", "city", "library_id", "category_id"]
303
}
279
}
(-)a/api/v1/swagger/parameters.json (-4 / +4 lines)
Lines 1-9 Link Here
1
{
1
{
2
  "borrowernumberPathParam": {
2
  "patron_id_pp": {
3
    "$ref": "parameters/patron.json#/borrowernumberPathParam"
3
    "$ref": "parameters/patron.json#/patron_id_pp"
4
  },
4
  },
5
  "borrowernumberQueryParam": {
5
  "patron_id_qp": {
6
    "$ref": "parameters/patron.json#/borrowernumberQueryParam"
6
    "$ref": "parameters/patron.json#/patron_id_qp"
7
  },
7
  },
8
  "city_id_pp": {
8
  "city_id_pp": {
9
    "$ref": "parameters/city.json#/city_id_pp"
9
    "$ref": "parameters/city.json#/city_id_pp"
(-)a/api/v1/swagger/parameters/patron.json (-5 / +5 lines)
Lines 1-15 Link Here
1
{
1
{
2
  "borrowernumberPathParam": {
2
  "patron_id_pp": {
3
    "name": "borrowernumber",
3
    "name": "patron_id",
4
    "in": "path",
4
    "in": "path",
5
    "description": "Internal patron identifier",
5
    "description": "Internal patron identifier",
6
    "required": true,
6
    "required": true,
7
    "type": "integer"
7
    "type": "integer"
8
  },
8
  },
9
  "borrowernumberQueryParam": {
9
  "patron_id_qp": {
10
    "name": "borrowernumber",
10
    "name": "patron_id",
11
    "in": "query",
11
    "in": "query",
12
    "description": "Internal borrower identifier",
12
    "description": "Internal patron identifier",
13
    "type": "integer"
13
    "type": "integer"
14
  }
14
  }
15
}
15
}
(-)a/api/v1/swagger/paths.json (-2 / +2 lines)
Lines 20-27 Link Here
20
  "/patrons": {
20
  "/patrons": {
21
    "$ref": "paths/patrons.json#/~1patrons"
21
    "$ref": "paths/patrons.json#/~1patrons"
22
  },
22
  },
23
  "/patrons/{borrowernumber}": {
23
  "/patrons/{patron_id}": {
24
    "$ref": "paths/patrons.json#/~1patrons~1{borrowernumber}"
24
    "$ref": "paths/patrons.json#/~1patrons~1{patron_id}"
25
  },
25
  },
26
  "/illrequests": {
26
  "/illrequests": {
27
    "$ref": "paths/illrequests.json#/~1illrequests"
27
    "$ref": "paths/illrequests.json#/~1illrequests"
(-)a/api/v1/swagger/paths/patrons.json (-137 / +95 lines)
Lines 8-16 Link Here
8
          "application/json"
8
          "application/json"
9
      ],
9
      ],
10
      "parameters": [{
10
      "parameters": [{
11
        "name": "borrowernumber",
11
        "name": "patron_id",
12
        "in": "query",
12
        "in": "query",
13
        "description": "Case insensitive search on borrowernumber",
13
        "description": "Search on patron_id",
14
        "required": false,
14
        "required": false,
15
        "type": "string"
15
        "type": "string"
16
      }, {
16
      }, {
Lines 38-44 Link Here
38
        "required": false,
38
        "required": false,
39
        "type": "string"
39
        "type": "string"
40
      }, {
40
      }, {
41
        "name": "othernames",
41
        "name": "other_name",
42
        "in": "query",
42
        "in": "query",
43
        "description": "Case insensitive search on othernames",
43
        "description": "Case insensitive search on othernames",
44
        "required": false,
44
        "required": false,
Lines 50-62 Link Here
50
        "required": false,
50
        "required": false,
51
        "type": "string"
51
        "type": "string"
52
      }, {
52
      }, {
53
        "name": "streetnumber",
53
        "name": "street_number",
54
        "in": "query",
54
        "in": "query",
55
        "description": "Case insensitive search on streetnumber",
55
        "description": "Case insensitive search on streetnumber",
56
        "required": false,
56
        "required": false,
57
        "type": "string"
57
        "type": "string"
58
      }, {
58
      }, {
59
        "name": "streettype",
59
        "name": "street_type",
60
        "in": "query",
60
        "in": "query",
61
        "description": "Case insensitive search on streettype",
61
        "description": "Case insensitive search on streettype",
62
        "required": false,
62
        "required": false,
Lines 86-92 Link Here
86
        "required": false,
86
        "required": false,
87
        "type": "string"
87
        "type": "string"
88
      }, {
88
      }, {
89
        "name": "zipcode",
89
        "name": "postal_code",
90
        "in": "query",
90
        "in": "query",
91
        "description": "Case insensitive search on zipcode",
91
        "description": "Case insensitive search on zipcode",
92
        "required": false,
92
        "required": false,
Lines 122-304 Link Here
122
        "required": false,
122
        "required": false,
123
        "type": "string"
123
        "type": "string"
124
      }, {
124
      }, {
125
        "name": "emailpro",
125
        "name": "secondary_email",
126
        "in": "query",
126
        "in": "query",
127
        "description": "Case insensitive search on emailpro",
127
        "description": "Case insensitive search on secondary_email",
128
        "required": false,
128
        "required": false,
129
        "type": "string"
129
        "type": "string"
130
      }, {
130
      }, {
131
        "name": "phonepro",
131
        "name": "secondary_phone",
132
        "in": "query",
132
        "in": "query",
133
        "description": "Case insensitive search on phonepro",
133
        "description": "Case insensitive search on secondary_phone",
134
        "required": false,
134
        "required": false,
135
        "type": "string"
135
        "type": "string"
136
      }, {
136
      }, {
137
        "name": "B_streetnumber",
137
        "name": "altaddress_street_number",
138
        "in": "query",
138
        "in": "query",
139
        "description": "Case insensitive search on B_streetnumber",
139
        "description": "Case insensitive search on altaddress_street_number",
140
        "required": false,
140
        "required": false,
141
        "type": "string"
141
        "type": "string"
142
      }, {
142
      }, {
143
        "name": "B_streettype",
143
        "name": "altaddress_street_type",
144
        "in": "query",
144
        "in": "query",
145
        "description": "Case insensitive search on B_streettype",
145
        "description": "Case insensitive search on altaddress_street_type",
146
        "required": false,
146
        "required": false,
147
        "type": "string"
147
        "type": "string"
148
      }, {
148
      }, {
149
        "name": "B_address",
149
        "name": "altaddress_address",
150
        "in": "query",
150
        "in": "query",
151
        "description": "Case insensitive search on B_address",
151
        "description": "Case insensitive search on altaddress_address",
152
        "required": false,
152
        "required": false,
153
        "type": "string"
153
        "type": "string"
154
      }, {
154
      }, {
155
        "name": "B_address2",
155
        "name": "altaddress_address2",
156
        "in": "query",
156
        "in": "query",
157
        "description": "Case insensitive search on B_address2",
157
        "description": "Case insensitive search on altaddress_address2",
158
        "required": false,
158
        "required": false,
159
        "type": "string"
159
        "type": "string"
160
      }, {
160
      }, {
161
        "name": "B_city",
161
        "name": "altaddress_city",
162
        "in": "query",
162
        "in": "query",
163
        "description": "Case insensitive search on B_city",
163
        "description": "Case insensitive search on altaddress_city",
164
        "required": false,
164
        "required": false,
165
        "type": "string"
165
        "type": "string"
166
      }, {
166
      }, {
167
        "name": "B_state",
167
        "name": "altaddress_state",
168
        "in": "query",
168
        "in": "query",
169
        "description": "Case insensitive search on B_state",
169
        "description": "Case insensitive search on altaddress_state",
170
        "required": false,
170
        "required": false,
171
        "type": "string"
171
        "type": "string"
172
      }, {
172
      }, {
173
        "name": "B_zipcode",
173
        "name": "altaddress_postal_code",
174
        "in": "query",
174
        "in": "query",
175
        "description": "Case insensitive search on B_zipcode",
175
        "description": "Case insensitive search on altaddress_postal_code",
176
        "required": false,
176
        "required": false,
177
        "type": "string"
177
        "type": "string"
178
      }, {
178
      }, {
179
        "name": "B_country",
179
        "name": "altaddress_country",
180
        "in": "query",
180
        "in": "query",
181
        "description": "Case insensitive search on B_country",
181
        "description": "Case insensitive search on altaddress_country",
182
        "required": false,
182
        "required": false,
183
        "type": "string"
183
        "type": "string"
184
      }, {
184
      }, {
185
        "name": "B_email",
185
        "name": "altaddress_email",
186
        "in": "query",
186
        "in": "query",
187
        "description": "Case insensitive search on B_email",
187
        "description": "Case insensitive search on altaddress_email",
188
        "required": false,
188
        "required": false,
189
        "type": "string"
189
        "type": "string"
190
      }, {
190
      }, {
191
        "name": "B_phone",
191
        "name": "altaddress_phone",
192
        "in": "query",
192
        "in": "query",
193
        "description": "Case insensitive search on B_phone",
193
        "description": "Case insensitive search on altaddress_phone",
194
        "required": false,
194
        "required": false,
195
        "type": "string"
195
        "type": "string"
196
      }, {
196
      }, {
197
        "name": "dateofbirth",
197
        "name": "date_of_birth",
198
        "in": "query",
198
        "in": "query",
199
        "description": "Case insensitive search on dateofbirth",
199
        "description": "Case insensitive search on date_of_birth",
200
        "required": false,
200
        "required": false,
201
        "type": "string"
201
        "type": "string"
202
      }, {
202
      }, {
203
        "name": "branchcode",
203
        "name": "library_id",
204
        "in": "query",
204
        "in": "query",
205
        "description": "Case insensitive search on branchcode",
205
        "description": "Case insensitive search on library_id",
206
        "required": false,
206
        "required": false,
207
        "type": "string"
207
        "type": "string"
208
      }, {
208
      }, {
209
        "name": "categorycode",
209
        "name": "category_id",
210
        "in": "query",
210
        "in": "query",
211
        "description": "Case insensitive search on categorycode",
211
        "description": "Case insensitive search on category_id",
212
        "required": false,
212
        "required": false,
213
        "type": "string"
213
        "type": "string"
214
      }, {
214
      }, {
215
        "name": "dateenrolled",
215
        "name": "date_enrolled",
216
        "in": "query",
216
        "in": "query",
217
        "description": "Case insensitive search on dateenrolled",
217
        "description": "Case insensitive search on date_enrolled",
218
        "required": false,
218
        "required": false,
219
        "type": "string"
219
        "type": "string"
220
      }, {
220
      }, {
221
        "name": "dateexpiry",
221
        "name": "expiry_date",
222
        "in": "query",
222
        "in": "query",
223
        "description": "Case insensitive search on dateexpiry",
223
        "description": "Case insensitive search on expiry_date",
224
        "required": false,
224
        "required": false,
225
        "type": "string"
225
        "type": "string"
226
      }, {
226
      }, {
227
        "name": "gonenoaddress",
227
        "name": "incorrect_address",
228
        "in": "query",
228
        "in": "query",
229
        "description": "Search on gonenoaddress",
229
        "description": "Search on incorrect_address",
230
        "required": false,
230
        "required": false,
231
        "type": "boolean"
231
        "type": "boolean"
232
      }, {
232
      }, {
233
        "name": "lost",
233
        "name": "patron_card_lost",
234
        "in": "query",
234
        "in": "query",
235
        "description": "Search on lost",
235
        "description": "Search on patron_card_lost",
236
        "required": false,
236
        "required": false,
237
        "type": "boolean"
237
        "type": "boolean"
238
      }, {
238
      }, {
239
        "name": "debarred",
239
        "name": "restricted",
240
        "in": "query",
240
        "in": "query",
241
        "description": "Case insensitive search on debarred",
241
        "description": "Filter search by restricted",
242
        "required": false,
242
        "required": false,
243
        "type": "string"
243
        "type": "boolean"
244
      }, {
245
        "name": "debarredcomment",
246
        "in": "query",
247
        "description": "Case insensitive search on debarredcomment",
248
        "required": false,
249
        "type": "string"
250
      }, {
251
        "name": "contactname",
252
        "in": "query",
253
        "description": "Case insensitive search on contactname",
254
        "required": false,
255
        "type": "string"
256
      }, {
257
        "name": "contactfirstname",
258
        "in": "query",
259
        "description": "Case insensitive search on contactfirstname",
260
        "required": false,
261
        "type": "string"
262
      }, {
263
        "name": "contacttitle",
264
        "in": "query",
265
        "description": "Case insensitive search on contacttitle",
266
        "required": false,
267
        "type": "string"
268
      }, {
269
        "name": "guarantorid",
270
        "in": "query",
271
        "description": "Case insensitive search on guarantorid",
272
        "required": false,
273
        "type": "string"
274
      }, {
275
        "name": "borrowernotes",
276
        "in": "query",
277
        "description": "Case insensitive search on borrowernotes",
278
        "required": false,
279
        "type": "string"
280
      }, {
244
      }, {
281
        "name": "relationship",
245
        "name": "guarantor_id",
282
        "in": "query",
246
        "in": "query",
283
        "description": "Case insensitive search on relationship",
247
        "description": "Search on guarantor_id",
284
        "required": false,
248
        "required": false,
285
        "type": "string"
249
        "type": "string"
286
      }, {
250
      }, {
287
        "name": "sex",
251
        "name": "staff_notes",
288
        "in": "query",
252
        "in": "query",
289
        "description": "Case insensitive search on sex",
253
        "description": "Case insensitive search on staff_notes",
290
        "required": false,
254
        "required": false,
291
        "type": "string"
255
        "type": "string"
292
      }, {
256
      }, {
293
        "name": "password",
257
        "name": "relationship_type",
294
        "in": "query",
258
        "in": "query",
295
        "description": "Case insensitive search on password",
259
        "description": "Case insensitive search on relationship_type",
296
        "required": false,
260
        "required": false,
297
        "type": "string"
261
        "type": "string"
298
      }, {
262
      }, {
299
        "name": "flags",
263
        "name": "gender",
300
        "in": "query",
264
        "in": "query",
301
        "description": "Case insensitive search on flags",
265
        "description": "Case insensitive search on gender",
302
        "required": false,
266
        "required": false,
303
        "type": "string"
267
        "type": "string"
304
      }, {
268
      }, {
Lines 308-394 Link Here
308
        "required": false,
272
        "required": false,
309
        "type": "string"
273
        "type": "string"
310
      }, {
274
      }, {
311
        "name": "opacnote",
275
        "name": "opac_notes",
312
        "in": "query",
276
        "in": "query",
313
        "description": "Case insensitive search on opacnote",
277
        "description": "Case insensitive search on opac_notes",
314
        "required": false,
278
        "required": false,
315
        "type": "string"
279
        "type": "string"
316
      }, {
280
      }, {
317
        "name": "contactnote",
281
        "name": "altaddress_notes",
318
        "in": "query",
282
        "in": "query",
319
        "description": "Case insensitive search on contactnote",
283
        "description": "Case insensitive search on altaddress_notes",
320
        "required": false,
284
        "required": false,
321
        "type": "string"
285
        "type": "string"
322
      }, {
286
      }, {
323
        "name": "sort1",
287
        "name": "statistics_1",
324
        "in": "query",
288
        "in": "query",
325
        "description": "Case insensitive search on sort1",
289
        "description": "Case insensitive search on statistics_1",
326
        "required": false,
290
        "required": false,
327
        "type": "string"
291
        "type": "string"
328
      }, {
292
      }, {
329
        "name": "sort2",
293
        "name": "statistics_2",
330
        "in": "query",
294
        "in": "query",
331
        "description": "Case insensitive search on sort2",
295
        "description": "Case insensitive search on statistics_2",
332
        "required": false,
296
        "required": false,
333
        "type": "string"
297
        "type": "string"
334
      }, {
298
      }, {
335
        "name": "altcontactfirstname",
299
        "name": "altcontact_firstname",
336
        "in": "query",
300
        "in": "query",
337
        "description": "Case insensitive search on altcontactfirstname",
301
        "description": "Case insensitive search on altcontact_firstname",
338
        "required": false,
302
        "required": false,
339
        "type": "string"
303
        "type": "string"
340
      }, {
304
      }, {
341
        "name": "altcontactsurname",
305
        "name": "altcontact_surname",
342
        "in": "query",
306
        "in": "query",
343
        "description": "Case insensitive search on altcontactsurname",
307
        "description": "Case insensitive search on altcontact_surname",
344
        "required": false,
308
        "required": false,
345
        "type": "string"
309
        "type": "string"
346
      }, {
310
      }, {
347
        "name": "altcontactaddress1",
311
        "name": "altcontact_address",
348
        "in": "query",
312
        "in": "query",
349
        "description": "Case insensitive search on altcontactaddress1",
313
        "description": "Case insensitive search on altcontact_address",
350
        "required": false,
314
        "required": false,
351
        "type": "string"
315
        "type": "string"
352
      }, {
316
      }, {
353
        "name": "altcontactaddress2",
317
        "name": "altcontact_address2",
354
        "in": "query",
318
        "in": "query",
355
        "description": "Case insensitive search on altcontactaddress2",
319
        "description": "Case insensitive search on altcontact_address2",
356
        "required": false,
320
        "required": false,
357
        "type": "string"
321
        "type": "string"
358
      }, {
322
      }, {
359
        "name": "altcontactaddress3",
323
        "name": "altcontact_city",
360
        "in": "query",
324
        "in": "query",
361
        "description": "Case insensitive search on altcontactaddress3",
325
        "description": "Case insensitive search on altcontact_city",
362
        "required": false,
326
        "required": false,
363
        "type": "string"
327
        "type": "string"
364
      }, {
328
      }, {
365
        "name": "altcontactstate",
329
        "name": "altcontact_state",
366
        "in": "query",
330
        "in": "query",
367
        "description": "Case insensitive search on altcontactstate",
331
        "description": "Case insensitive search on altcontact_state",
368
        "required": false,
332
        "required": false,
369
        "type": "string"
333
        "type": "string"
370
      }, {
334
      }, {
371
        "name": "altcontactzipcode",
335
        "name": "altcontact_postal_code",
372
        "in": "query",
336
        "in": "query",
373
        "description": "Case insensitive search on altcontactzipcode",
337
        "description": "Case insensitive search on altcontact_postal_code",
374
        "required": false,
338
        "required": false,
375
        "type": "string"
339
        "type": "string"
376
      }, {
340
      }, {
377
        "name": "altcontactcountry",
341
        "name": "altcontact_country",
378
        "in": "query",
342
        "in": "query",
379
        "description": "Case insensitive search on altcontactcountry",
343
        "description": "Case insensitive search on altcontact_country",
380
        "required": false,
344
        "required": false,
381
        "type": "string"
345
        "type": "string"
382
      }, {
346
      }, {
383
        "name": "altcontactphone",
347
        "name": "altcontact_phone",
384
        "in": "query",
348
        "in": "query",
385
        "description": "Case insensitive search on altcontactphone",
349
        "description": "Case insensitive search on altcontact_phone",
386
        "required": false,
350
        "required": false,
387
        "type": "string"
351
        "type": "string"
388
      }, {
352
      }, {
389
        "name": "smsalertnumber",
353
        "name": "sms_number",
390
        "in": "query",
354
        "in": "query",
391
        "description": "Case insensitive search on smsalertnumber",
355
        "description": "Case insensitive search on sms_number",
392
        "required": false,
356
        "required": false,
393
        "type": "string"
357
        "type": "string"
394
      }, {
358
      }, {
Lines 400-430 Link Here
400
      }, {
364
      }, {
401
        "name": "privacy",
365
        "name": "privacy",
402
        "in": "query",
366
        "in": "query",
403
        "description": "Case insensitive search on privacy",
367
        "description": "Search on privacy",
404
        "required": false,
368
        "required": false,
405
        "type": "string"
369
        "type": "string"
406
      }, {
370
      }, {
407
        "name": "privacy_guarantor_checkouts",
371
        "name": "privacy_guarantor_checkouts",
408
        "in": "query",
372
        "in": "query",
409
        "description": "Case insensitive search on privacy_guarantor_checkouts",
373
        "description": "Search on privacy_guarantor_checkouts",
410
        "required": false,
374
        "required": false,
411
        "type": "string"
375
        "type": "string"
412
      }, {
376
      }, {
413
        "name": "checkprevcheckout",
377
        "name": "check_previous_checkout",
414
        "in": "query",
378
        "in": "query",
415
        "description": "Case insensitive search on checkprevcheckout",
379
        "description": "Case insensitive search on check_previous_checkout",
416
        "required": false,
380
        "required": false,
417
        "type": "string"
381
        "type": "string"
418
      }, {
382
      }, {
419
        "name": "updated_on",
383
        "name": "updated_on",
420
        "in": "query",
384
        "in": "query",
421
        "description": "Case insensitive search on updated_on",
385
        "description": "Search on updated_on",
422
        "required": false,
386
        "required": false,
423
        "type": "string"
387
        "type": "string"
424
      }, {
388
      }, {
425
        "name": "lastseen",
389
        "name": "last_seen",
426
        "in": "query",
390
        "in": "query",
427
        "description": "Case insensitive search on lastseen",
391
        "description": "Case insensitive search on last_seen",
428
        "required": false,
392
        "required": false,
429
        "type": "string"
393
        "type": "string"
430
      }, {
394
      }, {
Lines 436-448 Link Here
436
      }, {
400
      }, {
437
        "name": "login_attempts",
401
        "name": "login_attempts",
438
        "in": "query",
402
        "in": "query",
439
        "description": "Case insensitive search on login_attempts",
403
        "description": "Search on login_attempts",
440
        "required": false,
441
        "type": "string"
442
      }, {
443
        "name": "overdrive_auth_token",
444
        "in": "query",
445
        "description": "Case insensitive search on overdrive_auth_token",
446
        "required": false,
404
        "required": false,
447
        "type": "string"
405
        "type": "string"
448
      }, {
406
      }, {
Lines 563-575 Link Here
563
      }
521
      }
564
    }
522
    }
565
  },
523
  },
566
  "/patrons/{borrowernumber}": {
524
  "/patrons/{patron_id}": {
567
    "get": {
525
    "get": {
568
      "x-mojo-to": "Patrons#get",
526
      "x-mojo-to": "Patrons#get",
569
      "operationId": "getPatron",
527
      "operationId": "getPatron",
570
      "tags": ["patrons"],
528
      "tags": ["patrons"],
571
      "parameters": [{
529
      "parameters": [{
572
        "$ref": "../parameters.json#/borrowernumberPathParam"
530
          "$ref": "../parameters.json#/patron_id_pp"
573
      }],
531
      }],
574
      "produces": [
532
      "produces": [
575
        "application/json"
533
        "application/json"
Lines 626-632 Link Here
626
      "tags": ["patrons"],
584
      "tags": ["patrons"],
627
      "parameters": [
585
      "parameters": [
628
        {
586
        {
629
          "$ref": "../parameters.json#/borrowernumberPathParam"
587
          "$ref": "../parameters.json#/patron_id_pp"
630
        },
588
        },
631
        {
589
        {
632
          "name": "body",
590
          "name": "body",
Lines 703-709 Link Here
703
      "operationId": "deletePatron",
661
      "operationId": "deletePatron",
704
      "tags": ["patrons"],
662
      "tags": ["patrons"],
705
      "parameters": [{
663
      "parameters": [{
706
        "$ref": "../parameters.json#/borrowernumberPathParam"
664
        "$ref": "../parameters.json#/patron_id_pp"
707
      }],
665
      }],
708
      "produces": ["application/json"],
666
      "produces": ["application/json"],
709
      "responses": {
667
      "responses": {
(-)a/api/v1/swagger/x-primitives.json (-3 / +2 lines)
Lines 3-11 Link Here
3
    "type": "integer",
3
    "type": "integer",
4
    "description": "internally assigned biblio identifier"
4
    "description": "internally assigned biblio identifier"
5
  },
5
  },
6
  "borrowernumber": {
6
  "patron_id": {
7
    "type": "integer",
7
    "type": "integer",
8
    "description": "internally assigned user identifier"
8
    "description": "Internal patron identifier"
9
  },
9
  },
10
  "cardnumber": {
10
  "cardnumber": {
11
    "type": ["string", "null"],
11
    "type": ["string", "null"],
12
- 

Return to bug 19784