Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ekirjasto 131 selected books #121

Open
wants to merge 35 commits into
base: main
Choose a base branch
from

Conversation

natlibfi-kaisa
Copy link
Contributor

@natlibfi-kaisa natlibfi-kaisa commented Dec 16, 2024

Description

Enables a Patron to add and remove books from their list of selected books.

Motivation and Context

This feature was requested for patrons to save books from the collection.

A short summary of the changes:

  • A new table selected_books which is also a class SelectedBook maps Patron and Work as a many-to-many relationship. If a Patron is removed, their selected books are also removed.

  • Two new routes for select and unselect requests are added and a new controller that creates responses to them:

    • /works/<identifier_type>/<path:identifier>/select_book: A POST request: When a book is selected, a selected-tag with it's creation date is added to the work's OPDS feed: <selected>2024-12-16T07:29:16+00:00</selected>.
    • /works/<identifier_type>/<path:identifier>/unselect_book: A DELETE request: When the patron removes the book from their selected books, the tag is removed from the feed.
    • /selected_books/<identifier_type>/<path:identifier>: GET and DELETE requests: A selected book's details can be fetched and the book can be deleted from the list.
  • A route /selected_books: GET request: Returns an OPDS acquisition feed with all the patron's selected books. This feed also contains loan/hold information atm.

  • The authentication document includes the link for selected books so it can be easily accessed via the apps.

  • Basically, since loans and hold and now selected books are patron dependent annotations, these are always checked and added to the patron's feed.

How Has This Been Tested?

Locally running the application.

Checklist

  • I have updated the documentation accordingly.
  • All new and existing tests passed.
  • Transifex translators have been notified. --> N/A

api/controller/select_books.py Outdated Show resolved Hide resolved
core/feed/acquisition.py Show resolved Hide resolved
Also removed the relationship from work side because there's no use for it
@natlibfi-kaisa natlibfi-kaisa marked this pull request as ready for review December 30, 2024 09:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants