Skip to content

Commit 3641449

Browse files
committed
🎨 initial changes
0 parents  commit 3641449

62 files changed

Lines changed: 1876 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
### Python template
2+
# Byte-compiled / optimized / DLL files
3+
__pycache__/
4+
*.py[cod]
5+
*$py.class
6+
7+
# C extensions
8+
*.so
9+
10+
# Distribution / packaging
11+
.Python
12+
build/
13+
develop-eggs/
14+
dist/
15+
downloads/
16+
eggs/
17+
.eggs/
18+
lib/
19+
lib64/
20+
parts/
21+
sdist/
22+
var/
23+
wheels/
24+
share/python-wheels/
25+
*.egg-info/
26+
.installed.cfg
27+
*.egg
28+
MANIFEST
29+
30+
# PyInstaller
31+
# Usually these files are written by a python script from a template
32+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
33+
*.manifest
34+
*.spec
35+
36+
# Installer logs
37+
pip-log.txt
38+
pip-delete-this-directory.txt
39+
40+
# Unit test / coverage reports
41+
htmlcov/
42+
.tox/
43+
.nox/
44+
.coverage
45+
.coverage.*
46+
.cache
47+
nosetests.xml
48+
coverage.xml
49+
*.cover
50+
*.py,cover
51+
.hypothesis/
52+
.pytest_cache/
53+
cover/
54+
55+
# Translations
56+
*.mo
57+
*.pot
58+
59+
# Django stuff:
60+
*.log
61+
local_settings.py
62+
db.sqlite3
63+
db.sqlite3-journal
64+
65+
# Flask stuff:
66+
instance/
67+
.webassets-cache
68+
69+
# Scrapy stuff:
70+
.scrapy
71+
72+
# Sphinx documentation
73+
docs/_build/
74+
75+
# PyBuilder
76+
.pybuilder/
77+
target/
78+
79+
# Jupyter Notebook
80+
.ipynb_checkpoints
81+
82+
# IPython
83+
profile_default/
84+
ipython_config.py
85+
86+
# pyenv
87+
# For a library or package, you might want to ignore these files since the code is
88+
# intended to run in multiple environments; otherwise, check them in:
89+
# .python-version
90+
91+
# pipenv
92+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
93+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
94+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
95+
# install all needed dependencies.
96+
#Pipfile.lock
97+
98+
# poetry
99+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
100+
# This is especially recommended for binary packages to ensure reproducibility, and is more
101+
# commonly ignored for libraries.
102+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
103+
#poetry.lock
104+
105+
# pdm
106+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
107+
#pdm.lock
108+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
109+
# in version control.
110+
# https://pdm.fming.dev/#use-with-ide
111+
.pdm.toml
112+
113+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
114+
__pypackages__/
115+
116+
# Celery stuff
117+
celerybeat-schedule
118+
celerybeat.pid
119+
120+
# SageMath parsed files
121+
*.sage.py
122+
123+
# Environments
124+
.env
125+
.venv
126+
env/
127+
venv/
128+
ENV/
129+
env.bak/
130+
venv.bak/
131+
132+
# Spyder project settings
133+
.spyderproject
134+
.spyproject
135+
136+
# Rope project settings
137+
.ropeproject
138+
139+
# mkdocs documentation
140+
/site
141+
142+
# mypy
143+
.mypy_cache/
144+
.dmypy.json
145+
dmypy.json
146+
147+
# Pyre type checker
148+
.pyre/
149+
150+
# pytype static type analyzer
151+
.pytype/
152+
153+
# Cython debug symbols
154+
cython_debug/
155+
156+
# PyCharm
157+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
158+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
159+
# and can be added to the global gitignore or merged into this file. For a more nuclear
160+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
161+
.idea/
162+
163+
# django static files
164+
staticfiles/
165+
static/CACHE/

.pre-commit-config.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
exclude: .+/migrations/.+\.py
2+
repos:
3+
- repo: https://github.com/psf/black
4+
rev: 22.12.0
5+
hooks:
6+
- id: black
7+
language_version: python3.11
8+
args: [--line-length=120]
9+
10+
- repo: https://github.com/PyCQA/flake8
11+
rev: 6.0.0
12+
hooks:
13+
- id: flake8
14+
args: [ --max-line-length=120 ]
15+
16+
- repo: https://github.com/pre-commit/pre-commit-hooks
17+
rev: v4.4.0
18+
hooks:
19+
- id: check-yaml
20+
- id: trailing-whitespace
21+
- id: end-of-file-fixer
22+
- id: debug-statements
23+
- id: requirements-txt-fixer

LICENSE

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
MIT License
2+
3+
Copyright (c) 2023, Sumit Singh
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6+
7+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8+
9+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Makefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
# compress
3+
compress:
4+
@echo "Compressing..."
5+
tailwindcss -i ./static/src/main.css -o ./static/src/output.css --minify
6+
7+
migrate:
8+
@echo "Migrating..."
9+
python manage.py migrate
10+
11+
create_migration:
12+
@echo "Creating migration..."
13+
python manage.py makemigrations

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# NOTE: This is WIP and not yet ready for use.
2+
3+
# RewardMe
4+
5+
RewardMe is a simple and easy to use reward system for your business. It is designed to be used in a retail environment,
6+
but can be used in any business that wants to reward their customers for their loyalty.
7+
8+
Idea here is to give points to customers for their purchases, and then they can redeem those points in next purchase.
9+
10+
## How it looks on the customer side
11+
12+
Landin page:
13+
![img.png](resources/landing.png)
14+
15+
Transaction page:
16+
![img.png](resources/transaction.png)
17+
18+
## TODO: update this file with more details
19+
20+
What's left to do:
21+
Check [TODO.md](TODO.md)

TODO.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
- Refactor views
2+
- Add tests
3+
- Button to resend otp
4+
- 3 Failed attempts and block user for 24 hours.
5+
- Throttle OTP generation
6+
- OTP support via third party services

accounts/__init__.py

Whitespace-only changes.

accounts/admin.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.contrib import admin
2+
3+
# Register your models here.

accounts/apps.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from django.apps import AppConfig
2+
3+
4+
class AccountsConfig(AppConfig):
5+
default_auto_field = "django.db.models.BigAutoField"
6+
name = "accounts"
7+
8+
def ready(self):
9+
import accounts.signals # noqa
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
# Generated by Django 4.1.5 on 2023-01-16 09:13
2+
3+
import django.contrib.auth.models
4+
from django.db import migrations, models
5+
import django.utils.timezone
6+
import uuid
7+
8+
9+
class Migration(migrations.Migration):
10+
11+
initial = True
12+
13+
dependencies = [
14+
("auth", "0012_alter_user_first_name_max_length"),
15+
]
16+
17+
operations = [
18+
migrations.CreateModel(
19+
name="OTPValidation",
20+
fields=[
21+
(
22+
"id",
23+
models.UUIDField(
24+
default=uuid.uuid4,
25+
editable=False,
26+
primary_key=True,
27+
serialize=False,
28+
),
29+
),
30+
("created_at", models.DateTimeField(auto_now_add=True, db_index=True)),
31+
("modified_at", models.DateTimeField(auto_now=True)),
32+
(
33+
"otp",
34+
models.CharField(blank=True, max_length=6, null=True, verbose_name="OTP"),
35+
),
36+
(
37+
"valid_until",
38+
models.DateTimeField(
39+
default=django.utils.timezone.now,
40+
help_text="The timestamp of the moment of expiry of the saved token.",
41+
),
42+
),
43+
(
44+
"destination",
45+
models.CharField(
46+
db_index=True,
47+
max_length=10,
48+
unique=True,
49+
verbose_name="OTP Generated For",
50+
),
51+
),
52+
("is_validated", models.BooleanField(default=False)),
53+
(
54+
"validate_attempt",
55+
models.IntegerField(default=3, verbose_name="Attempted Validation"),
56+
),
57+
(
58+
"otp_reactive_at",
59+
models.DateTimeField(blank=True, null=True, verbose_name="OTP Reactive At"),
60+
),
61+
("extra_data", models.JSONField(blank=True, null=True)),
62+
],
63+
options={
64+
"ordering": ["-created_at"],
65+
"abstract": False,
66+
},
67+
),
68+
migrations.CreateModel(
69+
name="User",
70+
fields=[
71+
("password", models.CharField(max_length=128, verbose_name="password")),
72+
(
73+
"last_login",
74+
models.DateTimeField(blank=True, null=True, verbose_name="last login"),
75+
),
76+
(
77+
"is_superuser",
78+
models.BooleanField(
79+
default=False,
80+
help_text="Designates that this user has all permissions without explicitly assigning them.",
81+
verbose_name="superuser status",
82+
),
83+
),
84+
(
85+
"id",
86+
models.UUIDField(
87+
default=uuid.uuid4,
88+
editable=False,
89+
primary_key=True,
90+
serialize=False,
91+
),
92+
),
93+
("created_at", models.DateTimeField(auto_now_add=True, db_index=True)),
94+
("modified_at", models.DateTimeField(auto_now=True)),
95+
(
96+
"username",
97+
models.CharField(max_length=10, unique=True, verbose_name="Mobile Number"),
98+
),
99+
("email", models.EmailField(blank=True, max_length=255, null=True)),
100+
("name", models.CharField(blank=True, max_length=255, null=True)),
101+
("is_active", models.BooleanField(default=True)),
102+
("is_staff", models.BooleanField(default=False)),
103+
(
104+
"groups",
105+
models.ManyToManyField(
106+
blank=True,
107+
help_text="The groups this user belongs to. A user will get all permissions granted to each of their groups.",
108+
related_name="user_set",
109+
related_query_name="user",
110+
to="auth.group",
111+
verbose_name="groups",
112+
),
113+
),
114+
(
115+
"user_permissions",
116+
models.ManyToManyField(
117+
blank=True,
118+
help_text="Specific permissions for this user.",
119+
related_name="user_set",
120+
related_query_name="user",
121+
to="auth.permission",
122+
verbose_name="user permissions",
123+
),
124+
),
125+
],
126+
options={
127+
"verbose_name": "User",
128+
"verbose_name_plural": "Users",
129+
},
130+
managers=[
131+
("objects", django.contrib.auth.models.UserManager()),
132+
],
133+
),
134+
]

0 commit comments

Comments
 (0)