Bugzilla – Attachment 158971 Details for
Bug 30070
Performance issues with edifactmsgs when you have a large number of messages
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30070: (follow-up) Filter out deleted files on the API
Bug-30070-follow-up-Filter-out-deleted-files-on-th.patch (text/plain), 4.03 KB, created by
Martin Renvoize (ashimema)
on 2023-11-15 09:20:46 UTC
(
hide
)
Description:
Bug 30070: (follow-up) Filter out deleted files on the API
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2023-11-15 09:20:46 UTC
Size:
4.03 KB
patch
obsolete
>From e588a4f32ff8d24671dbae57fdd93b7366cc4ab0 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >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. > >Signed-off-by: Ray Delahunty <r.delahunty@arts.ac.uk> >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > Koha/Edifact/File.pm | 1 + > Koha/REST/V1/Acquisitions/Vendor/Edifact/Files.pm | 6 ++++-- > api/v1/swagger/definitions/edifact_file.yaml | 5 ----- > t/db_dependent/api/v1/edifact_files.t | 14 ++++++++++---- > 4 files changed, 15 insertions(+), 11 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 >diff --git a/t/db_dependent/api/v1/edifact_files.t b/t/db_dependent/api/v1/edifact_files.t >index 5f85920ce84..fc0c38fa3c0 100755 >--- a/t/db_dependent/api/v1/edifact_files.t >+++ b/t/db_dependent/api/v1/edifact_files.t >@@ -66,15 +66,21 @@ subtest 'list() tests' => sub { > # No acquisitions\/edifiles, so empty array should be returned > $t->get_ok("//$userid:$password@/api/v1/acquisitions/edifiles")->status_is(200)->json_is( [] ); > >- my $file = $builder->build_object( { class => 'Koha::Edifact::Files', value => { message_type => 'ORDER' } } ); >+ my $file = $builder->build_object( >+ { class => 'Koha::Edifact::Files', value => { message_type => 'ORDER', deleted => 0 } } ); > >- # One file created, should get returned >+ my $deleted_file = $builder->build_object( >+ { class => 'Koha::Edifact::Files', value => { message_type => 'ORDER', deleted => 1 } } ); >+ >+ # One file undeleted, should get returned > $t->get_ok("//$userid:$password@/api/v1/acquisitions/edifiles")->status_is(200)->json_is( [ $file->to_api ] ); > > my $another_file_ORDER = >- $builder->build_object( { class => 'Koha::Edifact::Files', value => { message_type => 'ORDER' } } ); >+ $builder->build_object( >+ { class => 'Koha::Edifact::Files', value => { message_type => 'ORDER', deleted => 0 } } ); > my $another_file_QUOTE = >- $builder->build_object( { class => 'Koha::Edifact::Files', value => { message_type => 'QUOTE' } } ); >+ $builder->build_object( >+ { class => 'Koha::Edifact::Files', value => { message_type => 'QUOTE', deleted => 0 } } ); > > # Two files created, they should both be returned > $t->get_ok("//$userid:$password@/api/v1/acquisitions/edifiles")->status_is(200)->json_is( >-- >2.41.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 30070
:
158808
|
158809
|
158810
|
158887
|
158903
|
158904
|
158905
|
158906
|
158907
|
158908
|
158909
|
158910
|
158911
|
158912
|
158913
|
158914
|
158915
|
158918
|
158920
|
158922
|
158923
|
158924
|
158925
|
158926
|
158927
|
158928
|
158929
|
158930
|
158931
|
158932
|
158933
|
158934
|
158935
|
158936
|
158937
|
158938
|
158939
|
158940
|
158941
|
158942
|
158943
|
158944
|
158945
|
158946
|
158947
|
158948
|
158949
|
158950
|
158951
|
158952
|
158953
|
158954
|
158955
|
158963
|
158964
|
158965
|
158966
|
158967
|
158968
|
158969
|
158970
|
158971
|
158972
|
158973
|
158974
|
158975
|
159026
|
159027
|
159028
|
159029
|
159030
|
159031
|
159032
|
159033
|
159034
|
159035
|
159036
|
160336
|
160337
|
160338
|
160339
|
160340
|
160341
|
160342
|
160343
|
160344
|
160345
|
160346
|
160347
|
160348