Git Product home page Git Product logo

kamu's Introduction

Kamu

"Some books leave us free and some books make us free." โ€“ Ralph Waldo Emerson

Build Status Test Coverage Maintainability Open Source Helpers

Join the Matrix.org contributors chat at https://matrix.to/#/#kamu:matrix.org

Kamu is an application that focus on managing a physical library where you can add books, borrow and return them.

In the main page you can see the libraries shared between users. The libraries can be different unities, cities or name of friends that wants to share books. In the Screenshoot bellow, you can see an example of multiple libraries.

Screenshoot for Kamu's multiple libraries

Requirements

  • Python 3.6+ for Django backend
  • Node.js 8+ for frontend assets

Installation / Getting started

Here is a quick step-by-step minimal setup, to get the app up and running in your local workstation:

MacOS specific

To install Node.js and npm you can either download it from the node.js homepage or install it using homebrew:

brew install node

Platform independent

Create Python virtual enviroment:

python3 -m venv venv

Activate virtual enviroment (this command can change based on OS):

source venv/bin/activate

Install backend dependencies using pip:

pip install -r requirements.txt

Install frontend dependencies using npm:

npm install

Create database tables:

python manage.py migrate

Create a super user:

python manage.py createsuperuser

You will use this super user to login as administrator in your local Kamu application.

Seed the database with initial dump data:

python manage.py loaddata dump_data/*.json

Start your local server:

npm start

Now just go to http://localhost:8000 in your browser :)

For local setup with Okta authentication: Use the OKTA_METADATA_URL and OKTA_ENTITY_ID environment variables, concatenating it with the usual commands. Examples:

  OKTA_METADATA_URL='url-of-okta-saml' OKTA_ENTITY_ID='url-of-okta-login' npm start
  OKTA_METADATA_URL='url-of-okta-saml' OKTA_ENTITY_ID='url-of-okta-login' python manage.py migrate

Another way is to export the var and then execute the commands:

  export OKTA_METADATA_URL='url-of-okta-saml' OKTA_ENTITY_ID='url-of-okta-login'
  npm start
  python manage.py migrate

If you wish to disable Okta authentication again, execute:

  unset OKTA_METADATA_URL OKTA_ENTITY_ID

Using Docker for local development

Remember to create a .env file with all the environment variables you need for spining up the environment.

For building the image:

  make docker-build

If you're not planning to use a heroku like build or touch docker files, you can also pull from Dockerhub:

  make docker-pull

Create database tables:

  make docker-migrate

Create a super user (for non Okta based usage):

  make docker-createsuperuser

You will use this super user to login as administrator in your local Kamu application.

Seed the database with initial dump data:

  make docker-loaddata

Start your local server:

  make docker-dev

Now just go to http://localhost:8000 in your browser :)

For simulating a Heroku like environment (recommended to make build first):

  make docker-heroku

Access your local Heroku in the same link http://localhost:8000

Stop your environment:

  make docker-down

Deployment

We have out of the box support for Heroku ๐Ÿ‰, Dokku ๐Ÿณ and Docker ๐Ÿณ.

For deployment, create a new Python app and set the remote origin from Dokku or Heroku, push it and enable the Postgres plugin.

The buildpacks should configure all the necessary libraries for you.

Now, we need the following environment variables before running Kamu for the first time:

SECRET_KEY="django-secret-key" # https://duckduckgo.com/?q=django+secret+key+generator
DEBUG=true # Or false, depending if is a testing or production app
DJANGO_SETTINGS_MODULE="core.settings.prod" # If you plan to run a testing version
DATABASE_URL=postgres://dbhost/dbname # This variable should be automatically configured by the postgres extension.
ALLOWED_HOSTS="kamu.example.com, kamu.heroku.etc"
OKTA_METADATA_URL="SECRET-OKTA-STUFF" # On the case of Okta Authentication support
OKTA_ENTITY_ID="http://kamu.example.com/okta-login/acs/" # On the case of Okta Authentication support, the URL to the acs login route
ANALYTICS_ACCOUNT_ID="UA-123456789-1" # Only if you want to enable Google Analytics, otherwise don't set it
SENTRY_DSN="SECRET-SENTRY-DSN" # Only if you want to enable Sentry, otherwise don't set it
SSL=false # Enabled by default in production like deployments

See Dokku environment variables or Heroku Config Vars for more details.

On non Okta based deployments, you should run either dokku run kamu /bin/bash or heroku run /bin/bash -a kamu (On this case, kamu is app name)

python manage.py createsuperuser

See #74

Thanks!

kamu's People

Contributors

ayr-ton avatar bitsapien avatar dependabot[bot] avatar edersonbadeca avatar erikaya avatar flavia-by-flavia avatar lucashanke avatar macecchi avatar mergify[bot] avatar ritamoraes avatar rodbv avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kamu's Issues

Kamu gets into an infinite loop with Okta on Safari

The Safari browser behaves weird when trying to SSO for Kamu through Okta. It goes into a redirect loop.

Steps to reproduce:

  1. Open your Okta dashboard on Safari.
  2. Click on the Kamu link.
  3. Wait for the redirect frenzy to start ๐Ÿ˜

Add waiting list functionality

As a user
I want to be registered in the system as someone interested in that book
So that the system knows and stores my interest

Acceptance criteria
Given that a book has no copies available
When I join the waiting list
Then The system registers me in the waiting list

Given that a book has copies available
When I try to join the waiting list
Then I see a message telling me that there are available copies

Notify the user when a book on their wait list becomes available

As a user who is on the wait list for a book
When it becomes available
I want to receive an e-mail notification
So I can borrow the book

Acceptance Criteria

Given I have a book on my waitlist in a certain library
When a copy of that book is returned to the library
Then I receive an e-mail notification notifying me

Fulfill book details with ISBN from add a book page

As a Kamu user
When I'm on the "add a book" on admin books page
I want to fulfil the details using ISBN
So I can save time adding the details without the need of going to my library page.

Acceptance Criteria

Given that I'm at add a book admin page
When add the ISBN from a book
Then the details of that book will be fulfilled

How it's now

We already have the option of fulfil a book detail by ISBN only if I press the icon + on the library page.
If we go to Add a Book page, trough admin page, we have to fulfil the details without an automation.

How it should be

When I'm at the admin page I should have the same easy way to fulfil the books detail.

View the books on my wait list

As a user
I want to be able to see the books on my wait list
So that I can remember and talk to the person who has the book

Acceptance criteria

See book in My Books
Given I have joined the wait list for a book X
When I go to my books page
Then I see the book X under a 'my wait list' section

Loading indicator
Given I have joined the wait list for a book X
When I go to my books page
Then I see a loading indicator while the list is loading

No books on the wait list
Given I don't have any books on my wait list
When I go to my books page
Then I see a message saying I don't have books on my wait list

Improve README

As a Github user
When I go to README
I want to see more information about the current design for kamu
So I can make improvements in the front-end aligned with what kamu already has.

Acceptance Criteria
Given I am in the readme doc
When I scroll down trough it
Then I see some printscreens from different pages with explanation

Improve CONTRIBUTING.md

Let's discuss here improvements opportunities to the CONTRIBUTING.md that could help new collaborators.

Add frontend for wishlist functionality

Depends on #79

As a user I want to see the Wishlist from the library that I am logged.

Acceptance criteria

Given: I am logged on the system
When: I click on the menu Wishlist
Then: The system shows the Wish lists enabled for the library.

Given: I search a book, and the book is not registered on the system
When: I click on the button "Add to Wishlist"
Then: The system redirects me to Add Wishlist in the admin page.

Display a warning when borrowing a book that has a wait list

As a user who is in the wait list for a book X
When someone else tries to borrow X
I want to show a warning to the person saying I was waiting for X
So the person can confirm with me that it's ok to borrow it

Acceptance Criteria

Given
When
Then

Add default admin for first time deployments

As a non-Okta User
When I connect to Kamu for the first time
I want to have a default admin user and password
So I can configure the first users that will use Kamu

Acceptance Criteria

Given I have no Okta environment variables
When I try to login with admin username and (sudo su) password
Then I should be able to access the system and the admin page with full capabilities

Is your feature request related to a problem? Please describe.

For non-Okta based deployments, we need to manually connect to the instance and run python manage.py createsuperuser for creating the first superuser.

The responsibility for deleting or changing the admin credentials should be at the first administrator.

Don't forgot to remove the mention for this issue from README.md

Search by ISBN on API

As a user with the mobile Kamu app
When I scan a book's barcode ISBN
I want to see the details of that book
So I can borrow or return it using my phone

Acceptance Criteria

Given I'm using the library's books API (/library/bh/books)
When I provide an ISBN on the query parameters
Then I would like to see the books from that library related to that ISBN

Is your feature request related to a problem? Please describe.

Currently there isn't a way to search books by their ISBN, only their title and author, which is not enough for enabling a mobile app that scans books barcodes.

Describe the solution you'd like

The ideia is to provide an additional parameter on the library books/search API for the ISBN. An exact match by ISBN should return that book. If we cannot find an exact match, we could expand the ISBN details (author, title) and find a book that matches those parameters (because we don't currently have all books' ISBNs on database).

Leave the wait list of a book

As a user waiting for a book
When I check the books on my wait list
I want to be able to remove a book
So I can exit the wait list for a book I'm no longer interested in

Acceptance Criteria

Given I have joined the wait list for a book
When I see the book in the library or in my books page
Then it has a 'leave the waitlist' button

Given I have joined the wait list for a book
When I click the 'leave the waitlist' button
Then it removes the book from my wait list
And it shows the 'join the waitlist' button again

Opening an invalid library has unexpected behavior on the frontend

If you try to open the page of a library that does not exists, like /libraries/blablabla, it does not display an error. In fact, it throws a console error trying to parse the response from the API, because the API returns a 500 status code with an HTML error message, when the front-end is expecting an application/json response.

Additionally, the frontend will also cache the current library, which means in this case it will cache the invalid blablabla library as the default when the user returns to Kamu, instead of not caching it or keeping the previous one on the cache.

Expected behavior

  1. The API should return a 404 instead of a 500
  2. The frontend should display the standard error page from ErrorBoundary when a parsing error occurs
  3. The frontend should not set an invalid library as the user's current library

Create borrow/return endpoints that do not depend on copy ID

Currently we have endpoints that we need to pass the book copy ID to borrow or return a book. This requires the client to know which copy to take, which should be a responsibility from the backend, not the client. Having an endpoint that has the book and the library should be enough to borrow or return a book.

Quick Setup guide - don't work in some linux systems

Specifically in the openSuse and Debian system, the quick setup guide presents problems after the requirements install, i don't tested in more systems but the error occur when trying to do the command

python3 manage.py migrate

Yeah, just the command "python" won't wortk either on this systems, we need to standard the quick guide or to avoid this messages, the complete error message is:

Traceback (most recent call last): File "manage.py", line 22, in <module> execute_from_command_line(sys.argv) File "/home/vinicius/Vinicius/programs/Bucket/kamu/kamu/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line utility.execute() File "/home/vinicius/Vinicius/programs/Bucket/kamu/kamu/lib/python3.6/site-packages/django/core/management/__init__.py", line 357, in execute django.setup() File "/home/vinicius/Vinicius/programs/Bucket/kamu/kamu/lib/python3.6/site-packages/django/__init__.py", line 24, in setup apps.populate(settings.INSTALLED_APPS) File "/home/vinicius/Vinicius/programs/Bucket/kamu/kamu/lib/python3.6/site-packages/django/apps/registry.py", line 89, in populate app_config = AppConfig.create(entry) File "/home/vinicius/Vinicius/programs/Bucket/kamu/kamu/lib/python3.6/site-packages/django/apps/config.py", line 90, in create module = import_module(entry) File "/home/vinicius/Vinicius/programs/Bucket/kamu/kamu/lib64/python3.6/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 994, in _gcd_import File "<frozen importlib._bootstrap>", line 971, in _find_and_load File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked ModuleNotFoundError: No module named 'rest_framework'
Any clue about what i have to do in that case?

Order alphabetically the library list on the first page

As a Kamu user
When I enter in Kamu first page
I want to see the libraries list order alphabetically
So I can find my library easier.

Acceptance Criteria

Given I am in the library list page
When I see the libraries list
Then I can find the library that I want, in an order that I understand, making the process easier and faster.

How it is now

Screen Shot 2019-03-29 at 10 41 42

Add wishlist functionality

As a user
I want to be registered in the system as someone who wishes a book
So that the system knows and stores my wishes.

Acceptance criteria
Given that a book has no copies available.
When I mark the book as wished.
Then The system registers my wish and display in a list in the admin section.

Given that a book has copies available.
When I Try to mark the book as wished.
Then I see a message telling me that there are available copies.

Shareable book URL

The book detail page is currently a modal that pops up when browsing the library.

Kamu can take advantage of React Router to dynamically create a URL for it when opening the modal, so that users can copy that URL and share it with friends. The URL could be something like /libraries/bh/1234-example-book-mario-cecchi.

The main challenge here is that when loading the page from the URL, the app should fetch not only the library but also the provided book, because it can belong to a page in the library that wasn't loaded yet.

Make test coverage report work

As a Github user
When I go to README
I want to see the test coverage status
So I can decide to make improvements in test coverage for the code

Acceptance Criteria
Given I am in the readme doc
When I scroll down to the Code Coverage button
Then I see the percentage of test that's covering the code

How it is now:
screen shot 2018-10-17 at 21 37 39

How it should be:
screen shot 2018-10-17 at 21 38 18

ATTENTION only for the test coverage button. The other ones don't need to be changed!

Logo contribution

Hello! @ayr-ton

I have designed a functional logo for your repository. Please tell me what you think of them. And if you want, let's finish this together. I guess, the top logo will look very good in the readme file.

1

API should return the actions available for the book

Currently the business logic to understand wether the book can be borrowed, returned or added to wishlist is on the frontend. This should come from the API directly and this would help removing some extra logic from the React code and also help writing new versions of the frontend.

Update pysaml2 to fix known vulnerability

https://github.com/ayr-ton/kamu/network/alerts

Currently, there's no updated version that fixes this issue, I'm one of the maintainers of this plugin.

As this plugin is not an authentication backend for Django we may or update the plugin for supporting this or migrate to a new one that supports this.

Also, there's always the possibility of just fixing the initialization vector across encryptions and release a new plugin version with this.

Remove the book from my wait list after borrowing it

As a user who is on the wait list for the book X
When the book becomes available and I borrow it
I want it to be removed from my wait list
So I can keep the wait list organized

Acceptance Criteria

Given that I'm on the wait list for the book
When I borrow it
Then I no longer see it on my wait list

Given that I'm on the wait list for the book
When I try to borrow it but it's not available
Then it is NOT removed from my wait list

Given that I'm on the wait list for the book
When someone else borrows it
Then it is NOT removed from my wait list

Check how long I've been on the wait list for a book

As a user waiting for a book to become available
When I check my wait list
I want to see how long I've been on the wait list
So I can see if I should talk to the person who has it

Depends on #129.

An option would be to add something like a ribbon on the book component with the relative time the user has been waiting, or the date.

Acceptance Criteria

Given I have books on my wait list
When I open the My Books page
Then I see how long I've been on the wait list for each book in the Wait list section

Split the CSS code to a file for each component

Currently we have almost all of our CSS in a single file, App.css.

We could split that file so that each component has its own .css file, so that it's easier to understand where each css rule belongs to.

Suggest a different venv name

Currently the README suggests that the virtual environment share the same folder of a regular module (python3 -m venv kamu). I'd like to suggest changing the venv name to something else (maybe the conventional venv?) and keep them separated. Otherwise, if we decided using something else as virtual environment we need to delete each file or folder. Even the .gitignore is difficult to manage when we need to add all the different stuff from the venv and the module. For instance: the venv module created kamu/lib64 on my repository but this wasn't ignored before.

Direct users to add a copy after adding a book

As a Kamu user
When add a book
I want to have a copy on my library right after
So I can find the book that I want in the library without the need of going to another page

Acceptance Criteria

Given that added a book
When press Save button
Then I have an option to already add this book on my library

How it's now

When I press Save button, I'm redirected to books list and I assume that the book is already on my library. But it's not. I have to go to another page to add a book copy in my library. It's not intuitive!

How it should be

When I press Save button, I'm redirected to add book copy page so I can add a copy to my library and see it on my library bookshelf.

Describe alternatives you've considered

  • Redirect to add a book copy after save a new book, or
  • Have a pop-up (or other thing) after save a new book asking which library the person wants to add that book.

Remind user to return a book

As a user
When I had a book for a long time
I want to be notified
So I remember that I have to return the book

Dev commit:
The time that we consider "much time" must be discussed, for developments purpose consider one year configurable.

Acceptance Criteria
Given I have a book
When I have not reached the borrowing term
Then I don't receive a notification

Given I have a book
When I have reached the borrowing term
Then I receive a notification by mail asking to return the book

The cronjob feature is implemented to help on the development of this feature

Send mail task

Depends on #31

In order to notify borrowers out of term, Kamu needs to send mails to them.

Add book by ISBN13

As a librarian admin
I want to autocomplete the book info using ISBN13
So that I can save time adding a new book to the system

Currently is necessary to add all the book info manually when adding new books. If we have a huge list of books to add it takes a lot of time to finish the process, and it's boring. :-(

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.