From 2e4fcfa4535cbb3c9fbb7b3a7caf5f216996d036 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 14 Nov 2023 15:07:01 +0000 Subject: [PATCH] Bug 30070: (follow-up) Filter out deleted files on the API EDI uses a 'deleted' flag in the table to denote deleted files, we should filter those out of the API response. --- Koha/Edifact/File.pm | 1 + Koha/REST/V1/Acquisitions/Vendor/Edifact/Files.pm | 6 ++++-- api/v1/swagger/definitions/edifact_file.yaml | 5 ----- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Koha/Edifact/File.pm b/Koha/Edifact/File.pm index 2fd475221c9..66937acc27e 100644 --- a/Koha/Edifact/File.pm +++ b/Koha/Edifact/File.pm @@ -68,6 +68,7 @@ sub to_api_mapping { return { message_type => 'type', basketno => 'basket_id', + deleted => undef, }; } diff --git a/Koha/REST/V1/Acquisitions/Vendor/Edifact/Files.pm b/Koha/REST/V1/Acquisitions/Vendor/Edifact/Files.pm index 1f4ae3fc09e..fe9e2f3ed1c 100644 --- a/Koha/REST/V1/Acquisitions/Vendor/Edifact/Files.pm +++ b/Koha/REST/V1/Acquisitions/Vendor/Edifact/Files.pm @@ -46,16 +46,18 @@ Return the list of edifact files sub list { my $c = shift->openapi->valid_input or return; + my $filter = { deleted => 0 }; return try { - my $files_rs = Koha::Edifact::Files->new; + my $files_rs = Koha::Edifact::Files->search($filter); my $files = $c->objects->search($files_rs); return $c->render( status => 200, openapi => $files, ); - } catch { + } + catch { $c->unhandled_exception($_); }; } diff --git a/api/v1/swagger/definitions/edifact_file.yaml b/api/v1/swagger/definitions/edifact_file.yaml index 4f32fbe4cdc..2f7699de802 100644 --- a/api/v1/swagger/definitions/edifact_file.yaml +++ b/api/v1/swagger/definitions/edifact_file.yaml @@ -55,9 +55,4 @@ properties: - string - "null" description: Edifact file name - deleted: - type: - - boolean - - "null" - description: Is this file deleted additionalProperties: false -- 2.41.0