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

(-)a/api/v1/swagger/definitions/vendor.yaml (+5 lines)
Lines 119-124 properties: Link Here
119
    description: List of aliases
119
    description: List of aliases
120
    items:
120
    items:
121
      $ref: "vendor_alias.yaml"
121
      $ref: "vendor_alias.yaml"
122
  subscriptions_count:
123
    type:
124
      - integer
125
      - "null"
126
    description: Number of linked subscriptions
122
additionalProperties: false
127
additionalProperties: false
123
required:
128
required:
124
  - name
129
  - name
(-)a/api/v1/swagger/paths/acquisitions_vendors.yaml (+1 lines)
Lines 35-40 Link Here
35
          type: string
35
          type: string
36
          enum:
36
          enum:
37
            - aliases
37
            - aliases
38
            - subscriptions+count
38
        collectionFormat: csv
39
        collectionFormat: csv
39
    responses:
40
    responses:
40
      "200":
41
      "200":
(-)a/t/db_dependent/api/v1/acquisitions_vendors.t (-2 / +8 lines)
Lines 36-42 my $t = Test::Mojo->new('Koha::REST::V1'); Link Here
36
36
37
subtest 'list() and delete() tests | authorized user' => sub {
37
subtest 'list() and delete() tests | authorized user' => sub {
38
38
39
    plan tests => 40;
39
    plan tests => 44;
40
40
41
    $schema->storage->txn_begin;
41
    $schema->storage->txn_begin;
42
42
Lines 100-105 subtest 'list() and delete() tests | authorized user' => sub { Link Here
100
      ->json_is('/0/aliases/0/alias' => 'alias 1', 'alias 1 is embeded')
100
      ->json_is('/0/aliases/0/alias' => 'alias 1', 'alias 1 is embeded')
101
      ->json_is('/0/aliases/1/alias' => 'alias 2', 'alias 2 is embeded');
101
      ->json_is('/0/aliases/1/alias' => 'alias 2', 'alias 2 is embeded');
102
102
103
    for ( 0 .. 1 ) {
104
        $builder->build_object( { class => 'Koha::Subscriptions', value => { aqbooksellerid => $vendor->id } } );
105
    }
106
    $t->get_ok( "//$userid:$password@/api/v1/acquisitions/vendors" => { 'x-koha-embed' => 'subscriptions+count' } )
107
        ->status_is(200)->json_has( '/0/subscriptions_count', 'subscriptions_count is embeded' )
108
        ->json_is( '/0/subscriptions_count' => '2', 'subscription count is 2' );
109
103
    $t->delete_ok( "//$userid:$password@/api/v1/acquisitions/vendors/" . $vendor->id )
110
    $t->delete_ok( "//$userid:$password@/api/v1/acquisitions/vendors/" . $vendor->id )
104
      ->status_is(204, 'SWAGGER3.2.4')
111
      ->status_is(204, 'SWAGGER3.2.4')
105
      ->content_is('', 'SWAGGER3.3.4');
112
      ->content_is('', 'SWAGGER3.3.4');
106
- 

Return to bug 38390