Bug 28965

Summary: Add public routes for lists
Product: Koha Reporter: Tomás Cohen Arazi <tomascohen>
Component: REST APIAssignee: Tomás Cohen Arazi <tomascohen>
Status: Patch doesn't apply --- QA Contact:
Severity: new feature    
Priority: P5 - low CC: david, dcook, kyle, lucas, martin.renvoize, mathsabypro, nick
Version: unspecified   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on: 28948, 28959    
Bug Blocks: 18148    
Attachments: Bug 28965: filter_by_public() and filter_by_readable()
Bug 28965: Add /public/lists

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

    
Comment 1 Tomás Cohen Arazi 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 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 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 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.