From a94fafb458d6859ed84fcb3eacdcfd0354b35ef6 Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Thu, 30 Oct 2025 12:42:35 +0000 Subject: [PATCH] Bug 39320: (ERMCounts QA follow-up): Clean-up previous ERMCounts implementation --- api/v1/swagger/definitions/erm_counts.yaml | 7 -- api/v1/swagger/paths/erm_counts.yaml | 38 -------- api/v1/swagger/swagger.yaml | 7 -- .../prog/js/fetch/erm-api-client.js | 9 -- t/db_dependent/api/v1/erm_counts.t | 91 ------------------- 5 files changed, 152 deletions(-) delete mode 100644 api/v1/swagger/definitions/erm_counts.yaml delete mode 100644 api/v1/swagger/paths/erm_counts.yaml delete mode 100755 t/db_dependent/api/v1/erm_counts.t diff --git a/api/v1/swagger/definitions/erm_counts.yaml b/api/v1/swagger/definitions/erm_counts.yaml deleted file mode 100644 index a47d7dd358c..00000000000 --- a/api/v1/swagger/definitions/erm_counts.yaml +++ /dev/null @@ -1,7 +0,0 @@ ---- -type: object -properties: - counts: - type: object - description: List of ERM resources counts -additionalProperties: false diff --git a/api/v1/swagger/paths/erm_counts.yaml b/api/v1/swagger/paths/erm_counts.yaml deleted file mode 100644 index dfb91605eed..00000000000 --- a/api/v1/swagger/paths/erm_counts.yaml +++ /dev/null @@ -1,38 +0,0 @@ ---- -/erm/counts: - get: - x-mojo-to: ERM#counts - operationId: getERMcounts - description: This resource returns a list of ERM resources counts - summary: get the ERM counts - tags: - - erm_counts - produces: - - application/json - responses: - 200: - description: The ERM counts - schema: - $ref: "../swagger.yaml#/definitions/erm_counts" - 400: - description: Bad request - schema: - $ref: "../swagger.yaml#/definitions/error" - 403: - description: Access forbidden - schema: - $ref: "../swagger.yaml#/definitions/error" - 500: - description: | - Internal server error. Possible `error_code` attribute values: - - * `internal_server_error` - schema: - $ref: "../swagger.yaml#/definitions/error" - 503: - description: Under maintenance - schema: - $ref: "../swagger.yaml#/definitions/error" - x-koha-authorization: - permissions: - erm: 1 diff --git a/api/v1/swagger/swagger.yaml b/api/v1/swagger/swagger.yaml index 4b8e21c402e..14e41bd327f 100644 --- a/api/v1/swagger/swagger.yaml +++ b/api/v1/swagger/swagger.yaml @@ -50,8 +50,6 @@ definitions: $ref: ./definitions/desk.yaml edifact_file: $ref: ./definitions/edifact_file.yaml - erm_counts: - $ref: ./definitions/erm_counts.yaml erm_config: $ref: ./definitions/erm_config.yaml erm_agreement: @@ -337,8 +335,6 @@ paths: $ref: "./paths/deleted_biblios.yaml#/~1deleted~1biblios~1{biblio_id}" /erm/config: $ref: ./paths/erm_config.yaml#/~1erm~1config - /erm/counts: - $ref: ./paths/erm_counts.yaml#/~1erm~1counts /erm/agreements: $ref: ./paths/erm_agreements.yaml#/~1erm~1agreements "/erm/agreements/{agreement_id}": @@ -1208,9 +1204,6 @@ tags: - description: "Manage ERM configuration\n" name: erm_config x-displayName: ERM configuration - - description: "Get ERM resources counts\n" - name: erm_counts - x-displayName: ERM counts - description: "Manage ERM counter files\n" name: erm_counter_files x-displayName: ERM counter files diff --git a/koha-tmpl/intranet-tmpl/prog/js/fetch/erm-api-client.js b/koha-tmpl/intranet-tmpl/prog/js/fetch/erm-api-client.js index 49e1bad5964..b618e0d672b 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/fetch/erm-api-client.js +++ b/koha-tmpl/intranet-tmpl/prog/js/fetch/erm-api-client.js @@ -447,15 +447,6 @@ export class ERMAPIClient { }), }; } - - get counts() { - return { - get: () => - this.httpClient.get({ - endpoint: "counts", - }), - }; - } } export default ERMAPIClient; diff --git a/t/db_dependent/api/v1/erm_counts.t b/t/db_dependent/api/v1/erm_counts.t deleted file mode 100755 index ec0f5c454f1..00000000000 --- a/t/db_dependent/api/v1/erm_counts.t +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/env perl - -# This file is part of Koha. -# -# Koha is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# Koha is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Koha; if not, see . - -use Modern::Perl; - -use Test::NoWarnings; -use Test::More tests => 2; -use Test::Mojo; - -use t::lib::TestBuilder; -use t::lib::Mocks; - -use Koha::ERM::Agreements; -use Koha::ERM::Documents; -use Koha::ERM::EHoldings::Packages; -use Koha::ERM::EHoldings::Titles; -use Koha::ERM::Licenses; -use Koha::ERM::EUsage::UsageDataProviders; - -use Koha::Database; - -my $schema = Koha::Database->new->schema; -my $builder = t::lib::TestBuilder->new; - -my $t = Test::Mojo->new('Koha::REST::V1'); - -subtest 'count() tests' => sub { - - plan tests => 3; - - $schema->storage->txn_begin; - - Koha::ERM::Agreements->search->delete; - Koha::ERM::Documents->search->delete; - Koha::ERM::EHoldings::Packages->search->delete; - Koha::ERM::EHoldings::Titles->search->delete; - Koha::ERM::Licenses->search->delete; - Koha::ERM::EUsage::UsageDataProviders->search->delete; - - my $librarian = $builder->build_object( - { - class => 'Koha::Patrons', - value => { flags => 2**28 } - } - ); - - my $password = 'thePassword123'; - $librarian->set_password( { password => $password, skip_validation => 1 } ); - my $userid = $librarian->userid; - - ## Authorized user tests - my $agreement = $builder->build_object( - { - class => 'Koha::ERM::Agreements', - } - ); - - my $license = $builder->build_object( - { - class => 'Koha::ERM::Licenses', - } - ); - - $t->get_ok("//$userid:$password@/api/v1/erm/counts")->status_is(200)->json_is( - { - counts => { - agreements_count => 1, - documents_count => 0, - eholdings_packages_count => 0, - eholdings_titles_count => 0, - licenses_count => 1, - usage_data_providers_count => 0 - } - } - ); - $schema->storage->txn_rollback; -}; -- 2.39.5