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

(-)a/Koha/REST/V1/Patrons/Categories.pm (+20 lines)
Lines 50-53 sub list { Link Here
50
    };
50
    };
51
}
51
}
52
52
53
=head3 add
54
55
=cut
56
57
sub add {
58
    my $c = shift->openapi->valid_input or return;
59
60
    return try {
61
        my $category = Koha::Patron::Category->new_from_api( $c->req->json );
62
        $category->store;
63
        $c->res->headers->location( $c->req->url->to_string . '/' . $category->categorycode );
64
        return $c->render(
65
            status  => 201,
66
            openapi => $c->objects->to_api($category),
67
        );
68
    } catch {
69
        $c->unhandled_exception($_);
70
    };
71
}
72
53
1;
73
1;
(-)a/api/v1/swagger/definitions/patron.yaml (+4 lines)
Lines 408-413 properties: Link Here
408
      - "null"
408
      - "null"
409
    description: patron's primary contact method
409
    description: patron's primary contact method
410
    maxLength: 45
410
    maxLength: 45
411
  self_renewal_available:
412
    type:
413
      - boolean
414
    description: set to 1 if the patron is eligible to self renew and is within the renewal criteria
411
  _strings:
415
  _strings:
412
    type:
416
    type:
413
      - object
417
      - object
(-)a/api/v1/swagger/definitions/patron_category.yaml (+22 lines)
Lines 129-134 properties: Link Here
129
    type:
129
    type:
130
      - boolean
130
      - boolean
131
    description: Set threshold of debt allowed before issues are blocked
131
    description: Set threshold of debt allowed before issues are blocked
132
  self_renewal_enabled:
133
    type:
134
      - boolean
135
    description: Determine whether self-renewal is allowed for this category
136
  self_renewal_availability_start:
137
    type:
138
      - number
139
      - "null"
140
    description: How many days in advance of expiry self-renewal should become available
141
  self_renewal_if_expired:
142
    type:
143
      - number
144
      - "null"
145
    description: How many days after expiry self-renewal should still be available
146
  self_renewal_fines_block:
147
    type:
148
      - number
149
      - "null"
150
    description: How much can be accrued in fines before self-renewal is blocked
151
  self_renewal_failure_message:
152
    type: string
153
    description: The error message to display if self-renewal fails
132
additionalProperties: false
154
additionalProperties: false
133
required:
155
required:
134
  - patron_category_id
156
  - patron_category_id
(-)a/api/v1/swagger/paths/patron_categories.yaml (+46 lines)
Lines 52-54 Link Here
52
    x-koha-authorization:
52
    x-koha-authorization:
53
      permissions:
53
      permissions:
54
        parameters: manage_patron_categories
54
        parameters: manage_patron_categories
55
  post:
56
    x-mojo-to: Patrons::Categories#add
57
    operationId: addCategory
58
    tags:
59
      - categories
60
    summary: Add category
61
    parameters:
62
      - name: body
63
        in: body
64
        description: A JSON object containing informations about the new hold
65
        required: true
66
        schema:
67
          $ref: "../swagger.yaml#/definitions/patron_category"
68
    produces:
69
      - application/json
70
    responses:
71
      "201":
72
        description: Category added
73
        schema:
74
          $ref: "../swagger.yaml#/definitions/patron_category"
75
      "400":
76
        description: Bad request
77
        schema:
78
          $ref: "../swagger.yaml#/definitions/error"
79
      "401":
80
        description: Authentication required
81
        schema:
82
          $ref: "../swagger.yaml#/definitions/error"
83
      "403":
84
        description: Access forbidden
85
        schema:
86
          $ref: "../swagger.yaml#/definitions/error"
87
      "500":
88
        description: |
89
          Internal server error. Possible `error_code` attribute values:
90
91
          * `internal_server_error`
92
        schema:
93
          $ref: "../swagger.yaml#/definitions/error"
94
      "503":
95
        description: Under maintenance
96
        schema:
97
          $ref: "../swagger.yaml#/definitions/error"
98
    x-koha-authorization:
99
      permissions:
100
        parameters: manage_patron_categories
(-)a/api/v1/swagger/swagger.yaml (-1 / +4 lines)
Lines 154-159 definitions: Link Here
154
    $ref: ./definitions/patron_balance.yaml
154
    $ref: ./definitions/patron_balance.yaml
155
  patron_category:
155
  patron_category:
156
    $ref: ./definitions/patron_category.yaml
156
    $ref: ./definitions/patron_category.yaml
157
  patron_self_renewal:
158
    $ref: ./definitions/patron_self_renewal.yaml
157
  patron_extended_attribute:
159
  patron_extended_attribute:
158
    $ref: ./definitions/patron_extended_attribute.yaml
160
    $ref: ./definitions/patron_extended_attribute.yaml
159
  preservation_config:
161
  preservation_config:
Lines 581-586 paths: Link Here
581
    $ref: "./paths/public_patrons.yaml#/~1public~1patrons~1{patron_id}~1ill~1requests"
583
    $ref: "./paths/public_patrons.yaml#/~1public~1patrons~1{patron_id}~1ill~1requests"
582
  "/public/patrons/{patron_id}/password":
584
  "/public/patrons/{patron_id}/password":
583
    $ref: "./paths/public_patrons.yaml#/~1public~1patrons~1{patron_id}~1password"
585
    $ref: "./paths/public_patrons.yaml#/~1public~1patrons~1{patron_id}~1password"
586
  "/public/patrons/self_renewal":
587
    $ref: "./paths/public_patrons.yaml#/~1public~1patrons~1self_renewal"
584
  "/public/tickets":
588
  "/public/tickets":
585
    $ref: "./paths/tickets.yaml#/~1public~1tickets"
589
    $ref: "./paths/tickets.yaml#/~1public~1tickets"
586
  /quotes:
590
  /quotes:
587
- 

Return to bug 26355