diff --git a/.dockerignore b/.dockerignore index 6955232..95db102 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,2 +1,2 @@ README.md -LICENSE \ No newline at end of file +LICENSE diff --git a/README.md b/README.md index c9c8592..17eca65 100644 --- a/README.md +++ b/README.md @@ -30,4 +30,4 @@ #### Run tests ```shell docker-compose run django python manage.py test -``` \ No newline at end of file +``` diff --git a/commands/dev/django_loaddata.sh b/commands/dev/django_loaddata.sh index 0da7150..ce8a784 100644 --- a/commands/dev/django_loaddata.sh +++ b/commands/dev/django_loaddata.sh @@ -6,4 +6,4 @@ set -o pipefail # exits if any of your variables is not set set -o nounset -python manage.py loaddata roles.yaml \ No newline at end of file +python manage.py loaddata roles.yaml diff --git a/commands/dev/django_run_script.sh b/commands/dev/django_run_script.sh index 12f89ea..59c6c39 100644 --- a/commands/dev/django_run_script.sh +++ b/commands/dev/django_run_script.sh @@ -13,4 +13,4 @@ else docker-compose exec -it django \ sh -c "python manage.py runscript $filename" -fi \ No newline at end of file +fi diff --git a/core/apps/auth/schema.py b/core/apps/auth/schema.py index f6c1598..afb6ac6 100644 --- a/core/apps/auth/schema.py +++ b/core/apps/auth/schema.py @@ -3,12 +3,6 @@ OpenApiResponse, extend_schema, ) -from apps.auth.serializers import ( - LoginRefreshSerializer, - LoginSerializer, - RegisterMailSerializer, - RegisterSerializer, -) from rest_framework import status templates = { diff --git a/core/apps/auth/utils.py b/core/apps/auth/utils.py index 426a5a5..ad2d912 100644 --- a/core/apps/auth/utils.py +++ b/core/apps/auth/utils.py @@ -5,11 +5,11 @@ from django.contrib.auth import authenticate, login, logout from django.core.cache import cache from django.http import HttpRequest +from redis.exceptions import RedisError from rest_framework import exceptions from apps.api.tokens import encode_token from apps.users.models import User -from redis.exceptions import RedisError def access_token(user: Optional[User] = None) -> str: diff --git a/core/apps/auth/views.py b/core/apps/auth/views.py index 99598d4..06202bc 100644 --- a/core/apps/auth/views.py +++ b/core/apps/auth/views.py @@ -5,6 +5,14 @@ from apps.api.permissions import UnAuthenticated from apps.api.tokens import decode_token +from apps.auth.schema import ( + login_refresh_mail_schema, + login_refresh_schema, + login_schema, + logout_schema, + register_mail_schema, + register_schema, +) from apps.auth.serializers import ( LoginRefreshSerializer, LoginSerializer, @@ -12,7 +20,6 @@ RegisterSerializer, ) from apps.auth.utils import ( - auth_headers_jwt, auth_login, auth_logout, auth_refresh, @@ -20,14 +27,6 @@ from apps.emails.tasks import send_refresh_token_email, send_register_email from apps.emails.utils import CreateMail from apps.users.models import User -from apps.auth.schema import ( - register_mail_schema, - register_schema, - login_schema, - login_refresh_mail_schema, - login_refresh_schema, - logout_schema, -) class RegisterMailView(generics.GenericAPIView): diff --git a/core/apps/users/fixtures/roles.yaml b/core/apps/users/fixtures/roles.yaml index 1970b13..b019425 100644 --- a/core/apps/users/fixtures/roles.yaml +++ b/core/apps/users/fixtures/roles.yaml @@ -12,4 +12,4 @@ pk: 3 fields: name: PREMIUM - description: Premium role \ No newline at end of file + description: Premium role diff --git a/core/apps/users/management/commands/make_user_models.py b/core/apps/users/management/commands/make_user_models.py index 52dc161..86cecfa 100644 --- a/core/apps/users/management/commands/make_user_models.py +++ b/core/apps/users/management/commands/make_user_models.py @@ -1,5 +1,6 @@ -from django.core.management.base import BaseCommand import logging + +from django.core.management.base import BaseCommand from tests.users.factories import UserFactory logger = logging.getLogger(__name__) diff --git a/core/apps/users/views/roles_views.py b/core/apps/users/views/roles_views.py index 721a526..b4168d0 100644 --- a/core/apps/users/views/roles_views.py +++ b/core/apps/users/views/roles_views.py @@ -18,7 +18,7 @@ class RolesListView(GenericAPIView): def get_queryset(self, *args, **kwargs): queryset = Roles.objects.all() - name = kwargs.get("name", None) + name = kwargs.get("name") if name is not None: queryset = Roles.objects.filter(name=name) return queryset @@ -73,7 +73,7 @@ def get(self, request, *args, **kwargs): responses={status.HTTP_200_OK: None}, ) def delete(self, request, *args, **kwargs): - name = kwargs.get("name", None) + name = kwargs.get("name") instance = self.get_object() instance.delete() return Response( diff --git a/core/fixtures/friendship.json b/core/fixtures/friendship.json index 0637a08..fe51488 100644 --- a/core/fixtures/friendship.json +++ b/core/fixtures/friendship.json @@ -1 +1 @@ -[] \ No newline at end of file +[] diff --git a/core/fixtures/roles.json b/core/fixtures/roles.json index 4c94646..e4e1833 100644 --- a/core/fixtures/roles.json +++ b/core/fixtures/roles.json @@ -23,4 +23,4 @@ "description": "Premium role" } } -] \ No newline at end of file +] diff --git a/core/fixtures/users.json b/core/fixtures/users.json index c7c180a..3db0c34 100644 --- a/core/fixtures/users.json +++ b/core/fixtures/users.json @@ -52,4 +52,4 @@ ] } } -] \ No newline at end of file +] diff --git a/core/fixtures/users_basic.json b/core/fixtures/users_basic.json index 0ca68ea..44496d2 100644 --- a/core/fixtures/users_basic.json +++ b/core/fixtures/users_basic.json @@ -11,4 +11,4 @@ "is_premium": false } } -] \ No newline at end of file +] diff --git a/core/fixtures/users_premium.json b/core/fixtures/users_premium.json index 4a92a3f..220c6b2 100644 --- a/core/fixtures/users_premium.json +++ b/core/fixtures/users_premium.json @@ -11,4 +11,4 @@ "is_premium": true } } -] \ No newline at end of file +] diff --git a/core/pyproject.toml b/core/pyproject.toml index e708c7f..7adf2f4 100644 --- a/core/pyproject.toml +++ b/core/pyproject.toml @@ -128,4 +128,4 @@ envlist = [ "py311", "py310", "py39", -] \ No newline at end of file +] diff --git a/core/schemas/auth.json b/core/schemas/auth.json index a5b4e6e..e80a0e0 100644 --- a/core/schemas/auth.json +++ b/core/schemas/auth.json @@ -31,4 +31,4 @@ "email": "c@c.com" } } -} \ No newline at end of file +} diff --git a/core/scripts/my_scripts.py b/core/scripts/my_scripts.py index fa2121f..f9bd1c5 100644 --- a/core/scripts/my_scripts.py +++ b/core/scripts/my_scripts.py @@ -1,5 +1,6 @@ -from django.contrib.auth import get_user_model from pprint import pprint + +from django.contrib.auth import get_user_model from django.db import connection diff --git a/core/templates/emails/login/refresh.html b/core/templates/emails/login/refresh.html index 86fa1e0..72ebcca 100644 --- a/core/templates/emails/login/refresh.html +++ b/core/templates/emails/login/refresh.html @@ -36,4 +36,4 @@