Giter VIP home page Giter VIP logo

library-backend-django's Introduction

library-backend-django

Mini library backend service with Django

Features


  1. User role (Student, Librarian)
  2. Register user
  3. User login
  4. Book List
  5. Borrow book
  6. Return book
  7. Renew book due date
  8. User borrowed history

Requirements


  1. Python 3.8+
  2. Docker

Local Configuration


  1. clone source code from github

  2. go to project directory

    cd library-backend-django
  3. create your own project env

    python3 -m venv env
  4. activate your project env

    source env/bin/activate
  5. go to your project directory and install requirement.txt

    pip install -r requirement.txt
  6. run docker compose

    docker compose up -d
  7. migrate all models to database.

    python3 manage.py migrate
  8. then run the apps.

    python3 manage.py runserver
  9. create dummy users for testing. default password is password123

    python3 manage.py generate_users
    Username Role
    student1 student
    librarian1 librarian
  10. create dummy books for testing

python3 manage.py generate_books

Run The Test and Coverage


  1. run test case.

    python3 manage.py test

    the output should be like this:

    Found 13 test(s).
    Creating test database for alias 'default'...
    System check identified no issues (0 silenced).
    .............
    ----------------------------------------------------------------------
    Ran 13 tests in 7.528s
    
    OK
    Destroying test database for alias 'default'...
  2. run test coverage.

    coverage run --source='.' manage.py test .
    coverage report

    the output should be like this:

    Found 13 test(s).
    Creating test database for alias 'default'...
    System check identified no issues (0 silenced).
    .............
    ----------------------------------------------------------------------
    Ran 13 tests in 8.033s
    
    OK
    Destroying test database for alias 'default'...
    Name                                    Stmts   Miss  Cover
    -----------------------------------------------------------
    manage.py                                  12      2    83%
    src/__init__.py                             0      0   100%
    src/asgi.py                                 4      4     0%
    src/book/__init__.py                        0      0   100%
    src/book/admin.py                           1      0   100%
    src/book/apps.py                            4      0   100%
    src/book/factory.py                         9      0   100%
    src/book/migrations/0001_initial.py         5      0   100%
    src/book/migrations/__init__.py             0      0   100%
    src/book/models.py                          7      0   100%
    src/book/serializers.py                    21      0   100%
    src/book/tests.py                          39      0   100%
    src/book/views.py                          25      0   100%
    src/borrow/__init__.py                      0      0   100%
    src/borrow/admin.py                         1      0   100%
    src/borrow/apps.py                          4      0   100%
    src/borrow/factory.py                      13      0   100%
    src/borrow/migrations/0001_initial.py       7      0   100%
    src/borrow/migrations/__init__.py           0      0   100%
    src/borrow/models.py                       14      0   100%
    src/borrow/serializers.py                  47      0   100%
    src/borrow/tests.py                        59      0   100%
    src/borrow/views.py                        45      0   100%
    src/iam/__init__.py                         0      0   100%
    src/iam/admin.py                            1      0   100%
    src/iam/apps.py                             4      0   100%
    src/iam/factory.py                         15      0   100%
    src/iam/migrations/0001_initial.py          7      0   100%
    src/iam/migrations/__init__.py              0      0   100%
    src/iam/models.py                           7      0   100%
    src/iam/permissions.py                     12      0   100%
    src/iam/serializers.py                     22      0   100%
    src/iam/tests.py                           48      0   100%
    src/iam/views.py                           38      0   100%
    src/settings.py                            19      0   100%
    src/urls.py                                 8      0   100%
    src/wsgi.py                                 4      4     0%
    -----------------------------------------------------------
    TOTAL                                     502     10    98%

Postman


You can try API with postman by import the collection and environment file

library-backend-django's People

Contributors

kaajee avatar

Watchers

 avatar

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.