Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ test: build
${DOCKER_COMPOSE_RUN_WEB} web python manage.py test --failfast api

deprecations: build migrate
${DOCKER_COMPOSE_RUN_WEB} web python -Wa manage.py test --failfast api
${DOCKER_COMPOSE_RUN_WEB} web python -Wa manage.py test

shell:
${DOCKER_COMPOSE_RUN_WEB} web ash
Expand Down
4 changes: 2 additions & 2 deletions environment/requirements/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
asgiref==3.10.0
backcall==0.2.0
decorator==5.2.1
Django==4.2.25
Django==5.2.7
django-extensions==4.1
djangorestframework==3.16.1
Faker==37.8.0
Expand All @@ -19,8 +19,8 @@ ptyprocess==0.7.0
pycodestyle==2.8.0
pyflakes==2.4.0
Pygments==2.19.2
setuptools==80.9.0
sqlparse==0.5.3
traitlets==5.14.3
typing_extensions==4.15.0
tzdata==2025.2
wcwidth==0.2.14
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 5.2.7 on 2025-10-06 17:09

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('api', '0001_initial'),
]

operations = [
migrations.AlterField(
model_name='clientwallettransaction',
name='transaction_type',
field=models.IntegerField(choices=[(0, 'Error'), (1, 'Testing'), (2, 'Deposit'), (3, 'Withdraw')], default=1, help_text='Add or substract money'),
),
]
4 changes: 2 additions & 2 deletions src/api/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class WalletTransaction(models.Model):

amount and client_wallet_account are the only required fields.
"""
class Type(models.TextChoices):
class Type(models.IntegerChoices):
ERROR = 0
TESTING = 1
DEPOSIT = 2
Expand All @@ -79,7 +79,7 @@ class Type(models.TextChoices):
amount = models.DecimalField(max_digits=7, decimal_places=2)
done = models.BooleanField(default=True, help_text="It check if the transaction was completed")
transaction_type = models.IntegerField(
choices=Type.choices, default=Type.TESTING.value, help_text="Add or substract money"
choices=Type, default=Type.TESTING.value, help_text="Add or substract money"
)
error_msg = models.CharField(max_length=250, null=True, blank=True, unique=False,
help_text="Ex. Transaction error: negative balance")
Expand Down
18 changes: 9 additions & 9 deletions src/api/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -670,11 +670,11 @@ def test_create_regular_user_transactions_as_regular_user(self):
"client_wallet_account": self.regular_user_wallet.id
}
if payload.get('amount', 0) > 0:
transaction_type = str(ClientWalletTransaction.Type.DEPOSIT.value)
transaction_type = ClientWalletTransaction.Type.DEPOSIT.value
elif payload.get('amount', 0) < 0:
transaction_type = str(ClientWalletTransaction.Type.WITHDRAW.value)
transaction_type = ClientWalletTransaction.Type.WITHDRAW.value
else:
transaction_type = str(ClientWalletTransaction.Type.TESTING.value)
transaction_type = ClientWalletTransaction.Type.TESTING.value
response_data = {
**payload,
"amount": str(payload.get('amount')),
Expand Down Expand Up @@ -734,11 +734,11 @@ def test_create_regular_user_transactions_as_staff_user(self):
"client_wallet_account": self.regular_user_wallet.id
}
if payload.get('amount', 0) > 0:
transaction_type = str(ClientWalletTransaction.Type.DEPOSIT.value)
transaction_type = ClientWalletTransaction.Type.DEPOSIT.value
elif payload.get('amount', 0) < 0:
transaction_type = str(ClientWalletTransaction.Type.WITHDRAW.value)
transaction_type = ClientWalletTransaction.Type.WITHDRAW.value
else:
transaction_type = str(ClientWalletTransaction.Type.TESTING.value)
transaction_type = ClientWalletTransaction.Type.TESTING.value
response_data = {
**payload,
"amount": str(payload.get('amount')),
Expand Down Expand Up @@ -778,11 +778,11 @@ def test_create_staff_user_transactions_as_staff_user(self):
"client_wallet_account": user_wallet.id
}
if payload.get('amount', 0) > 0:
transaction_type = str(ClientWalletTransaction.Type.DEPOSIT.value)
transaction_type = ClientWalletTransaction.Type.DEPOSIT.value
elif payload.get('amount', 0) < 0:
transaction_type = str(ClientWalletTransaction.Type.WITHDRAW.value)
transaction_type = ClientWalletTransaction.Type.WITHDRAW.value
else:
transaction_type = str(ClientWalletTransaction.Type.TESTING.value)
transaction_type = ClientWalletTransaction.Type.TESTING.value
response_data = {
**payload,
"amount": str(payload.get('amount')),
Expand Down
5 changes: 0 additions & 5 deletions src/commons/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

Author: Adrian G
Created: 2019/03/16
Contact: mroot5@outlook.es
Notes:
test --keepdb
https://docs.djangoproject.com/en/dev/ref/django-admin/#cmdoption-test-keepdb
Expand All @@ -18,10 +17,6 @@

https://docs.djangoproject.com/en/dev/topics/testing/tools/#exceptions
https://docs.python.org/3/library/unittest.html#unittest.TestCase.assertRaises

Terminal colors:
* Yellow: \e[33mText\e[0m
* Red: \e[32mText\e[0m
"""


Expand Down
11 changes: 9 additions & 2 deletions src/django_atomic_transactions/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,15 @@
'USER': os.environ.get('DJANGO_DATABASE_USER'),
'PASSWORD': os.environ.get('DJANGO_DATABASE_PASSWORD'),
'HOST': os.environ.get('DJANGO_DATABASE_HOST'),
'PORT': os.environ.get('DJANGO_DATABASE_PORT', 5432)
}
'PORT': os.environ.get('DJANGO_DATABASE_PORT', 5432),
'OPTIONS': {
'pool': {
'min_size': 1,
'max_size': 4,
'timeout': 10,
}
}
},
}

AUTH_PASSWORD_VALIDATORS = [
Expand Down