Skip to content

mur4ik18/django-referral-system

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Djang Referral System

 

Djang Referral System

Github language Repository size

About   |   Features   |   Technologies   |   Requirements   |   Starting   |   License   |   Author


🎯 About

I created django referral system and I wanna show it for other people! If you wanna contrib you are welcome!

✨ Features

✔️ New user can signUp only with referral code;
✔️ Each new user get 3 referral codes for friends;
✔️ Each new admin get 5 referral codes;

🚀 Technologies

The following tools were used in this project:

✅ Requirements

Before starting 🏁, you need to have Git and Python + Poetry installed. In the project I used postgresql, you need to start postgresql so you need Docker-compose.

🏁 Starting

# Clone this project
$ git clone https://github.com/mur4ik18/django-referral-system && cd django-referral-system

# Install dependencies
$ poetry install

# Run env
$ poetry shell

# Run postgresql (If you don't have)
$ docker-compose -f db.yml up --build -d

# Start project
$ python src/manage.py runserver

🏁 Works with api

Create account:

POST http://127.0.0.1:8000/auth/jwt/create/
body={
"username":"admin",
"password":"admin"
}

It return:

{
    "refresh": "refresh_token",
    "access": "access_token"
}

Get tokens list:

GET http://127.0.0.1:8000/api/v1/get_tokens/
Headers={
"Authorization":"JWT access_token",
}

It return:

[
    {
        "token": "w3iP8GJt1woqLRM6MNrNx88JxuI",
        "user": 1,
        "refer_relations": [
	   {
	    "employer": 1,
	    "employee": 10,
	    "refer_token": 1
            }
	]
    },
    {
        "token": "E6VQuA4qFucR028UW0XL6FAW8vw",
        "user": 1,
        "refer_relations": []
    },
    ...
]

Create new account:

POST http://127.0.0.1:8000/auth/users/
body={
"username":"user",
"password":"password1",
"email":"user@gmail.com",
"referral_token":"E6VQuA4qFucR028UW0XL6FAW8vw",
}

It return:

{
    "referral_token": "E6VQuA4qFucR028UW0XL6FAW8vw",
    "email": "test@test.com1",
    "username": "test1sdas",
    "id": 11
}

📝 License

Made with ❤️ by mur4ik18

 

Back to top

About

I doesn't find examples in internet, so I wrote it and I gonna show you how to do that

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages