Bug 28965

Summary: Add public routes for lists
Product: Koha Reporter: Tomás Cohen Arazi (tcohen) <tomascohen>
Component: REST APIAssignee: Tomás Cohen Arazi (tcohen) <tomascohen>
Status: RESOLVED FIXED QA Contact: Martin Renvoize (ashimema) <martin.renvoize>
Severity: new feature    
Priority: P5 - low CC: david, dcook, kyle, lucas, martin.renvoize, mathsabypro, nick, tomascohen
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38050
GIT URL: Change sponsored?: ---
Patch complexity: Small patch Documentation contact:
Documentation submission: Text to go in the release notes:
This enhancement adds new public API endpoint for retrieving lists.
Version(s) released in:
24.11.00
Circulation function:
Bug Depends on: 28948, 28959    
Bug Blocks: 18148, 38050    
Attachments: Bug 28965: filter_by_public() and filter_by_readable()
Bug 28965: Add /public/lists
Bug 28965: filter_by_public() and filter_by_readable()
Bug 28965: Add /public/lists
Bug 28965: filter_by_public() and filter_by_readable()
Bug 28965: Add /public/lists
Bug 28965: (QA follow-up) Fix misc qa issues
Bug 28965: (QA follow-up) Fix misc qa issues
Bug 28965: filter_by_public() and filter_by_readable()
Bug 28965: Add /public/lists
Bug 28965: (QA follow-up) Fix misc qa issues
Bug 28965: Unit tests
Bug 28965: filter_by_public() and filter_by_readable()
Bug 28965: Add /public/lists
Bug 28965: (QA follow-up) Fix misc qa issues
Bug 28965: Unit tests

Description Tomás Cohen Arazi (tcohen) 2021-09-07 16:23:22 UTC

    
Comment 1 Tomás Cohen Arazi (tcohen) 2021-09-08 02:55:04 UTC
Created attachment 124635 [details] [review]
Bug 28965: filter_by_public() and filter_by_readable()

This patch adds helper methods for lists resultsets. Tests are added for
their behavior.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Virtualshelves.t
=> SUCCESS: Tests pass!
3. Sign off :-D
Comment 2 Tomás Cohen Arazi (tcohen) 2021-09-08 02:55:08 UTC
Created attachment 124636 [details] [review]
Bug 28965: Add /public/lists

This patch adds a route for publicly retrieving lists.
Comment 3 Tomás Cohen Arazi (tcohen) 2021-09-08 02:57:18 UTC
Submitting early to highlight the coolness of what we did on bug 28948. It still needs tests.

I will file a separate bug for all the CRUD (staff/public). The barebones are done anyway :-D
Comment 4 David Nind 2021-09-08 19:33:25 UTC
Tests fail for me after applying patch (and dependencies) 8-(...

root@kohadevbox:koha(bz28965)$ prove t/db_dependent/Virtualshelves.t
t/db_dependent/Virtualshelves.t .. No method count found for Koha::Virtualshelves DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Unknown column 'public' in 'where clause' at /kohadevbox/koha/Koha/Objects.pm line 601
 at /kohadevbox/koha/Koha/Virtualshelf.pm line 99.
DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Unknown column 'public' in 'field list' at /kohadevbox/koha/Koha/Object.pm line 170
    # Looks like you planned 13 tests but ran 1.
t/db_dependent/Virtualshelves.t .. 1/8 
#   Failed test 'CRUD'
#   at t/db_dependent/Virtualshelves.t line 110.
DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Unknown column 'public' in 'field list' at /kohadevbox/koha/Koha/Object.pm line 170
# Looks like your test exited with 11 just after 1.
t/db_dependent/Virtualshelves.t .. Dubious, test returned 11 (wstat 2816, 0xb00)
Failed 8/8 subtests 

Test Summary Report
-------------------
t/db_dependent/Virtualshelves.t (Wstat: 2816 Tests: 1 Failed: 1)
  Failed test:  1
  Non-zero exit status: 11
  Parse errors: Bad plan.  You planned 8 tests but ran 1.
Files=1, Tests=1,  2 wallclock secs ( 0.02 usr  0.00 sys +  1.58 cusr  0.15 csys =  1.75 CPU)
Result: FAIL
Comment 5 Tomás Cohen Arazi (tcohen) 2021-09-08 19:37:30 UTC
(In reply to David Nind from comment #4)
> Tests fail for me after applying patch (and dependencies) 8-(...
> 
> root@kohadevbox:koha(bz28965)$ prove t/db_dependent/Virtualshelves.t
> t/db_dependent/Virtualshelves.t .. No method count found for
> Koha::Virtualshelves DBIx::Class::Storage::DBI::_dbh_execute(): DBI
> Exception: DBD::mysql::st execute failed: Unknown column 'public' in 'where
> clause' at /kohadevbox/koha/Koha/Objects.pm line 601

This failure is because you didn't run the updatedatabase script with bug 28959 applied. That said, I found some missing bits on that bug as well. So hold on.
Comment 6 David Cook 2023-05-05 02:22:01 UTC
(In reply to Tomás Cohen Arazi from comment #5)
> This failure is because you didn't run the updatedatabase script with bug
> 28959 applied. That said, I found some missing bits on that bug as well. So
> hold on.

Now that the dependencies are pushed, what else needs to be done to move this into Needs Signoff?
Comment 7 Jonathan Druart 2023-11-28 09:45:33 UTC
*** Bug 34577 has been marked as a duplicate of this bug. ***
Comment 8 David Cook 2023-11-28 23:13:45 UTC
Seems like there's a few of us keen on this one. Let's get this one in? 

I'm hoping to tackle bug 18148 before the end of the year, but it relies on having a public list endpoint.
Comment 9 Martin Renvoize (ashimema) 2024-05-01 14:11:26 UTC
Created attachment 165976 [details] [review]
Bug 28965: filter_by_public() and filter_by_readable()

This patch adds helper methods for lists resultsets. Tests are added for
their behavior.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Virtualshelves.t
=> SUCCESS: Tests pass!
3. Sign off :-D

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 10 Martin Renvoize (ashimema) 2024-05-01 14:11:29 UTC
Created attachment 165977 [details] [review]
Bug 28965: Add /public/lists

This patch adds a route for publicly retrieving lists.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 11 Martin Renvoize (ashimema) 2024-05-01 14:12:25 UTC
I've rebased this and got it passing QA scripts.. however it needs a good testing and QA run.
Comment 12 Martin Renvoize (ashimema) 2024-09-17 12:31:49 UTC
Still applies.. would be nice to see someone QA it soon.
Comment 13 David Cook 2024-10-09 04:59:28 UTC
(In reply to Martin Renvoize (ashimema) from comment #12)
> Still applies.. would be nice to see someone QA it soon.

I've got quite the backlog at the moment, but since this blocks bug 18148 it's definitely on my radar.
Comment 14 David Cook 2024-10-29 01:03:22 UTC
I know I'm being slow on this one, but this is one of those ones I'm really going to do at some point, as it relates to a customer request.

I figure November/December timeline. Hopefully sooner rather than later but we'll see...
Comment 15 Kyle M Hall (khall) 2024-10-29 12:17:20 UTC
Created attachment 173624 [details] [review]
Bug 28965: filter_by_public() and filter_by_readable()

This patch adds helper methods for lists resultsets. Tests are added for
their behavior.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Virtualshelves.t
=> SUCCESS: Tests pass!
3. Sign off :-D

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 16 Kyle M Hall (khall) 2024-10-29 12:17:27 UTC
Created attachment 173625 [details] [review]
Bug 28965: Add /public/lists

This patch adds a route for publicly retrieving lists.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 17 Kyle M Hall (khall) 2024-10-29 12:17:30 UTC
Created attachment 173626 [details] [review]
Bug 28965: (QA follow-up) Fix misc qa issues

* Tidy code
* Fix number of unit tests
* Remove unecessary use of delete

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 18 Kyle M Hall (khall) 2024-10-29 12:18:00 UTC
Tomas, can you add api unit tests?
Comment 19 Kyle M Hall (khall) 2024-10-29 12:25:03 UTC
Created attachment 173627 [details] [review]
Bug 28965: (QA follow-up) Fix misc qa issues

* Tidy code
* Fix number of unit tests
* Fix use of delete

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 20 Tomás Cohen Arazi (tcohen) 2024-10-29 12:34:18 UTC
(In reply to Kyle M Hall (khall) from comment #18)
> Tomas, can you add api unit tests?

Oops. Sure!
Comment 21 Tomás Cohen Arazi (tcohen) 2024-10-29 19:22:13 UTC
Created attachment 173687 [details] [review]
Bug 28965: filter_by_public() and filter_by_readable()

This patch adds helper methods for lists resultsets. Tests are added for
their behavior.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Virtualshelves.t
=> SUCCESS: Tests pass!
3. Sign off :-D

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 22 Tomás Cohen Arazi (tcohen) 2024-10-29 19:22:16 UTC
Created attachment 173688 [details] [review]
Bug 28965: Add /public/lists

This patch adds a route for publicly retrieving lists.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 23 Tomás Cohen Arazi (tcohen) 2024-10-29 19:22:19 UTC
Created attachment 173689 [details] [review]
Bug 28965: (QA follow-up) Fix misc qa issues

* Tidy code
* Fix number of unit tests
* Fix use of delete

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 24 Tomás Cohen Arazi (tcohen) 2024-10-29 19:22:22 UTC
Created attachment 173690 [details] [review]
Bug 28965: Unit tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 25 Tomás Cohen Arazi (tcohen) 2024-10-29 19:23:23 UTC
(In reply to Kyle M Hall (khall) from comment #18)
> Tomas, can you add api unit tests?

Done, please review the changes and let me know if there's something else missing. Thanks!
Comment 26 Martin Renvoize (ashimema) 2024-10-31 11:49:20 UTC
Created attachment 173780 [details] [review]
Bug 28965: filter_by_public() and filter_by_readable()

This patch adds helper methods for lists resultsets. Tests are added for
their behavior.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Virtualshelves.t
=> SUCCESS: Tests pass!
3. Sign off :-D

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 27 Martin Renvoize (ashimema) 2024-10-31 11:49:23 UTC
Created attachment 173781 [details] [review]
Bug 28965: Add /public/lists

This patch adds a route for publicly retrieving lists.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 28 Martin Renvoize (ashimema) 2024-10-31 11:49:26 UTC
Created attachment 173782 [details] [review]
Bug 28965: (QA follow-up) Fix misc qa issues

* Tidy code
* Fix number of unit tests
* Fix use of delete

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 29 Martin Renvoize (ashimema) 2024-10-31 11:49:29 UTC
Created attachment 173783 [details] [review]
Bug 28965: Unit tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 30 Martin Renvoize (ashimema) 2024-10-31 11:49:46 UTC
All looking good here now, thanks :)
Comment 31 Katrin Fischer 2024-11-08 15:09:59 UTC
Pushed for 24.11!

Well done everyone, thank you!
Comment 32 David Nind 2024-12-11 18:19:28 UTC
API not covered in the manual, so no updates required.