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

(-)a/Koha/REST/V1/CirculationRules.pm (-1 / +13 lines)
Lines 50-56 sub list_rules { Link Here
50
    my $c = shift->openapi->valid_input or return;
50
    my $c = shift->openapi->valid_input or return;
51
51
52
    return try {
52
    return try {
53
        my $effective       = $c->param('effective') // 1;
53
        my $effective = $c->param('effective') // 1;
54
        my $kinds =
54
        my $kinds =
55
            defined( $c->param('rules') )
55
            defined( $c->param('rules') )
56
            ? [ split /\s*,\s*/, $c->param('rules') ]
56
            ? [ split /\s*,\s*/, $c->param('rules') ]
Lines 157-162 sub list_rules { Link Here
157
157
158
        }
158
        }
159
159
160
        # Map context into rules
161
        @{$rules} = map {
162
            my %new_rule = %$_;
163
            my %context  = (
164
                "library_id"         => delete $new_rule{"branchcode"}   // "*",
165
                "patron_category_id" => delete $new_rule{"categorycode"} // "*",
166
                "item_type_id"       => delete $new_rule{"itemtype"}     // "*",
167
            );
168
            $new_rule{"context"} = \%context;
169
            \%new_rule;
170
        } @{$rules};
171
160
        return $c->render(
172
        return $c->render(
161
            status  => 200,
173
            status  => 200,
162
            openapi => $rules
174
            openapi => $rules
(-)a/api/v1/swagger/definitions/circulation_rules.yaml (+19 lines)
Line 0 Link Here
1
---
2
type: object
3
properties:
4
  context:
5
    type: object
6
    properties:
7
      patron_category_id:
8
        type: string
9
        description: Patron category id
10
      library_id:
11
        type: string
12
        description: Library branch id
13
      item_type_id:
14
        type: string
15
        description: Item type id
16
    description: Context of the ruleset
17
additionalProperties: true
18
required:
19
  - context
(-)a/api/v1/swagger/paths/circulation_rules.yaml (-1 / +1 lines)
Lines 40-46 Link Here
40
        schema:
40
        schema:
41
          type: array
41
          type: array
42
          items:
42
          items:
43
            type: object
43
            $ref: "../swagger.yaml#/definitions/circulation_rules"
44
      "400":
44
      "400":
45
        description: Bad request
45
        description: Bad request
46
        schema:
46
        schema:
(-)a/api/v1/swagger/swagger.yaml (-1 / +2 lines)
Lines 12-17 definitions: Link Here
12
    $ref: ./definitions/authorised_value.yaml
12
    $ref: ./definitions/authorised_value.yaml
13
  authorised_value_category:
13
  authorised_value_category:
14
    $ref: ./definitions/authorised_value_category.yaml
14
    $ref: ./definitions/authorised_value_category.yaml
15
  circulation_rules:
16
    $ref: ./definitions/circulation_rules.yaml
15
  identity_provider:
17
  identity_provider:
16
    $ref: ./definitions/identity_provider.yaml
18
    $ref: ./definitions/identity_provider.yaml
17
  identity_provider_domain:
19
  identity_provider_domain:
18
- 

Return to bug 37256