Bug 28965 - Add public routes for lists
Summary: Add public routes for lists
Status: ASSIGNED
Alias: None
Product: Koha
Classification: Unclassified
Component: REST API (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low new feature (vote)
Assignee: Tomás Cohen Arazi
QA Contact:
URL:
Keywords:
Depends on: 28948 28959
Blocks: 18148
  Show dependency treegraph
 
Reported: 2021-09-07 16:23 UTC by Tomás Cohen Arazi
Modified: 2021-09-08 19:37 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 28965: filter_by_public() and filter_by_readable() (6.40 KB, patch)
2021-09-08 02:55 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 28965: Add /public/lists (8.20 KB, patch)
2021-09-08 02:55 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
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.