Git Product home page Git Product logo

test_task_1's Introduction

Simple referral system

Test task
for Hammer Systems

Conventional Commits pre-commit


FeaturesTech stackHow To UseDocumentationAdditional material

Features

  • Authentication by JWT token
  • Authorization by phone number. First request to enter phone number.
  • Simulate sending a 4-digit authorization code (1-2 sec delay on the server) using celery task
  • In the user's profile, the user has the opportunity to enter one other person's invite code (when entering it, check for existence).
  • In the user's profile the list of users (phone numbers) who have entered the current user's invite code is displayed.
  • Redoc
  • Swagger
  • flower for celery task monitoring

Tech stack

How To Use

Use Docker
  1. Firstly clone repo

    git clone [email protected]:mrKazzila/test_python_dev_Hammer_Systems.git
  2. Prepare env with make

    make prepare_docker_env
  3. Run docker compose with make

    make docker_run
  4. Stop docker compose with make

    make docker_stop
Local commands
  1. Firstly clone repo

    git clone [email protected]:mrKazzila/test_python_dev_Hammer_Systems.git
  2. Prepare local env with make

    make prepare_local_env
  3. Settings Poetry with make

    make poetry_setup
  4. Run project dependencies, migrations, & run test server with make

    make django_run
  5. Run Redis Server

    make redis_run
  6. Run Celery

    make celery_run
  7. Run test with make

    make test
  8. Run pre-commit with make

    make test_linters

Documentation

API Documentation

POST | Getting an authentication code: http://localhost:8000/api/v1/auth/signup/

Example:

  • Request

    {
        "username": "Jhon",
        "phone_number": "12345678901"
    }
    
  • Response

    {
        "code": "1236"
    }
    

POST | Getting an authentication token and referral code: http://localhost:8000/api/v1/auth/code/

Example:

  • Request

    {
        "code": "1236"
    }
    
  • Response

    {
        "token": "bssiyw-f169337fbe692e91f373200fd087e533",
        "referral code": "Qz3Isl"
    }
    

GET | Getting the users list: http://localhost:8000/api/v1/users/

Example:

  • Response

    [
        {
            "username": "Zak",
            "phone_number": "29535315881",
            "referral_code": "Qz3Isl",
            "used_referral_code": "",
            "referral_users_list": [
                {
                    "phone": "19535315881"
                }
            ]
        },
        {
            "username": "Jhon",
            "phone_number": "19535315881",
            "referral_code": "fxmSIJ",
            "used_referral_code": "Qz3Isl",
            "referral_users_list": []
        }
    ]
    

POST | Creating user: http://localhost:8000/api/v1/users/

Example:

  • Request

    {
        "username": "Nick",
        "phone_number": "49535315881",
        "referral_code": "oxtSIn",
        "used_referral_code": ""
    }
    
  • Response

    {
        "username": "Nick",
        "phone_number": "49535315881",
        "referral_code": "oxtSIn",
        "used_referral_code": "",
        "referral_users_list": []
    }
    

GET | Getting a user: http://localhost:8000/api/v1/users/<username>/

Example:

  • Response

    {
        "username": "Jhon",
        "phone_number": "19535315881",
        "referral_code": "fxmSIJ",
        "used_referral_code": "Qz3Isl",
        "referral_users_list": []
    }
    

PATCH | Update user info: http://localhost:8000/api/v1/users/<username>/

Example:

  • Request

    {
        "username": "makwcy",
        "phone_number": "29535713841",
        "referral_code": "pfvIfl",
        "used_referral_code": "",
        "referral_users_list": []
    }
    
  • Response

    {
        "username": "makwcy",
        "phone_number": "29535713841",
        "referral_code": "pfvIfl",
        "used_referral_code": "",
        "referral_users_list": []
    }
    

PUT | Update user info: http://localhost:8000/api/v1/users/<username>/

Example:

  • Request

    {
        "username": "makwcy",
        "phone_number": "29535713841",
        "referral_code": "pfvIfl",
        "used_referral_code": "",
        "referral_users_list": []
    }
    
  • Response

    {
        "username": "makwcy",
        "phone_number": "29535713841",
        "referral_code": "pfvIfl",
        "used_referral_code": "",
        "referral_users_list": []
    }
    

DELETE | Delete user: http://localhost:8000/api/v1/users/<username>/

Example:

  • Response

    {
        "username": "makwcy",
        "phone_number": "29535713841",
        "referral_code": "pfvIfl",
        "used_referral_code": "",
        "referral_users_list": []
    }
    

Additional material

test_task_1's People

Contributors

mrkazzila 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.