Skip to content

DmytroHlazyrin/Library-service-api

Repository files navigation

RESTful API for Library 📚

Overview 🔎

This project is a Django-based application that provides a REST API for managing a library's book borrowing system. The API allows users to:

  • View available books
  • Borrow books
  • Receive notifications on Telegram
  • Make payments for borrowed books

The application ensures proper authentication and permissions to manage user access and actions.

Table of Contents 📑

  1. Overview
  2. Features
  3. Installation
  4. Setting up Environment Variables
  5. Starting the Server
  6. Run Tests
  7. Run with Docker
  8. Getting Access
  9. Contributing

Features

Books 📚

  • All users can browse the list of books.
  • Only staff members can add new books to the library.

Borrowings 🔄

  • Registered users without outstanding payments can borrow available books.
  • Overdue returns incur a fine.

Payments 💳

  • Users are prompted to pay via Stripe upon creating a borrowing.
  • Payment sessions are valid for 24 hours.

Authentication 🔐

  • Secure JWT authentication for user access.

Documentation 📑

  • Comprehensive API documentation with Swagger, DRF Spectacular, and Redoc.

Scheduling ⏰

  • Task scheduling and automation using Celery and Celery Beat.

Notifications 📬

  • Detailed notifications for staff in the Telegram chat:
    1. Creation of a new borrowing.
    2. Successful payment.
    3. Daily report of overdue and soon-to-be overdue borrowings.
    4. Daily payment report.
    5. Monthly payment report.

Installation 🔧

  1. Clone the repository:
git clone https://github.com/DmytroHlazyrin/Library-service-api.git
  1. Go to the project directory:
cd Library-service-api
  1. Create and activate venv:
python -m venv venv 
source venv/bin/activate(on macOS)
venv\Scripts\activate(on Windows)
  1. Set the project assignments:
pip install -r requirements.txt

Setting up Environment Variables

touch .env  

Example of environment variables you can find in file:

 .env.sample 

Starting the server 🚀

  1. Create database migrations:
python manage.py makemigrations
python manage.py migrate
  1. Create superuser:
python manage.py createsuperuser
  1. *Load test data:
python manage.py loaddata library_service_db_data.json

Default superuser for testing 👤

  1. Start the development server:
python manage.py runserver

Run tests 🖋

python manage.py test

Run with Docker 🐳

docker-compose build  
docker-compose up 

Getting access 🔑

create user via api/user/register  
get access token via api/user/token  

Contributing 🤝

We welcome contributions to improve this project! If you would like to contribute, please follow these steps:

  1. Fork the repository.
  2. Create a new branch.
  3. Make your changes and commit them.
  4. Push to your branch.
  5. Create a pull request.

Please ensure your code adheres to our coding standards and includes appropriate tests.

Conclusion 🎉

Thank you for checking out our Library Management System project! We hope this API makes it easier to manage book borrowings, payments, and notifications in your library. With comprehensive features, secure authentication, and detailed documentation, we strive to provide a robust and user-friendly solution.

Happy coding!

About

API for library

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors