API service for managing library with DRF. Implemented possibility of managing books. Also you can borrow books and return them.
Python 3 should be installed. Docker should be installed.
git clone https://github.com/rakamakaphone/library-api
cd library-api
python -m venv venv
source venv\Scripts\activate
pip install -r requirements.txt
python manage.py migrate
python manage.py runserver
This project uses environment variables to store sensitive information such as the Django secret key.
Create a .env
file in the root directory of your project and add your environment variables to it.
This file should not be committed to the repository.
You can see the example in .env.sample
file.
Use the following command to load prepared data from fixture to test and debug your code:
python manage.py loaddata fixture_data.json
After loading data from fixture you can use user (or create another one by yourself):
Login: [email protected]
Password: pass1234
create user via /api/user/register/
get access token via /api/user/token/
- Admin panel.
- Creating user via email.
- Managing own profile.
- Managing books for admin users.
- Filtering books by title and author.
- Borrowing books with possibility to return them.
- Non-admins can see only their borrowings.
- Filtering active borrowings for all users.
- Filtering by user_id for admin users.
- Added different permissions for different actions.
- Added validation for date and book inventory.
- Added tests for different endpoints.
- JWT authenticated.
- Documentation located at /api/doc/swagger/