Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Dec 2, 2024
1 parent c8e245c commit a2e98b6
Show file tree
Hide file tree
Showing 33 changed files with 8,513 additions and 8,537 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
README.md
LICENSE
LICENSE
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@
#### Run tests
```shell
docker-compose run django python manage.py test
```
```
2 changes: 1 addition & 1 deletion commands/dev/django_loaddata.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
python manage.py loaddata roles.yaml
2 changes: 1 addition & 1 deletion commands/dev/django_run_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ else
docker-compose exec -it django \
sh -c "python manage.py runscript $filename"

fi
fi
6 changes: 0 additions & 6 deletions core/apps/auth/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@
OpenApiResponse,
extend_schema,
)
from apps.auth.serializers import (
LoginRefreshSerializer,
LoginSerializer,
RegisterMailSerializer,
RegisterSerializer,
)
from rest_framework import status

templates = {
Expand Down
2 changes: 1 addition & 1 deletion core/apps/auth/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
17 changes: 8 additions & 9 deletions core/apps/auth/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,28 @@

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,
RegisterMailSerializer,
RegisterSerializer,
)
from apps.auth.utils import (
auth_headers_jwt,
auth_login,
auth_logout,
auth_refresh,
)
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):
Expand Down
2 changes: 1 addition & 1 deletion core/apps/users/fixtures/roles.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
pk: 3
fields:
name: PREMIUM
description: Premium role
description: Premium role
3 changes: 2 additions & 1 deletion core/apps/users/management/commands/make_user_models.py
Original file line number Diff line number Diff line change
@@ -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__)
Expand Down
4 changes: 2 additions & 2 deletions core/apps/users/views/roles_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion core/fixtures/friendship.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[]
[]
2 changes: 1 addition & 1 deletion core/fixtures/roles.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@
"description": "Premium role"
}
}
]
]
2 changes: 1 addition & 1 deletion core/fixtures/users.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@
]
}
}
]
]
2 changes: 1 addition & 1 deletion core/fixtures/users_basic.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
"is_premium": false
}
}
]
]
2 changes: 1 addition & 1 deletion core/fixtures/users_premium.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
"is_premium": true
}
}
]
]
2 changes: 1 addition & 1 deletion core/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,4 @@ envlist = [
"py311",
"py310",
"py39",
]
]
2 changes: 1 addition & 1 deletion core/schemas/auth.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@
"email": "[email protected]"
}
}
}
}
3 changes: 2 additions & 1 deletion core/scripts/my_scripts.py
Original file line number Diff line number Diff line change
@@ -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


Expand Down
2 changes: 1 addition & 1 deletion core/templates/emails/login/refresh.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ <h1>
</div>
</div>
</body>
</html>
</html>
2 changes: 1 addition & 1 deletion core/templates/emails/register/register.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ <h1>
</div>
</div>
</body>
</html>
</html>
14 changes: 7 additions & 7 deletions core/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import pytest
from apps.api.tokens import encode_token
from django.db import connections
from pathlib import Path

import psycopg2
from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT
from config.settings.testing import env
from django.core.management import call_command
import pytest
from config.env import BASE_DIR
from pathlib import Path
from config.settings.testing import env
from django.conf import settings
from django.core.management import call_command
from django.db import connections
from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT


def run_sql(sql):
Expand Down
18 changes: 10 additions & 8 deletions core/tests/users/conftest.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import base64
from io import BytesIO

import pytest
from apps.auth.utils import encode_token
from django.contrib.auth.hashers import make_password
from PIL import Image
from pytest_factoryboy import register

from tests.users.factories import (
UserFactory,
FriendshipFactory,
RolesFactory,
UserBasicFactory,
UserFactory,
UserPremiumFactory,
RolesFactory,
FriendshipFactory,
)
from apps.auth.utils import encode_token
import base64
from io import BytesIO
from PIL import Image
from django.contrib.auth.hashers import make_password


@pytest.fixture(scope="function")
Expand Down
13 changes: 6 additions & 7 deletions core/tests/users/factories.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
import json
import logging
from enum import Enum
from typing import Optional
from uuid import uuid4
from apps.users.models import ProfileMixin

import factory
from apps.api.tokens import encode_token
from apps.users.models import ProfileMixin, User
from apps.users.types import UserModelType
from django.db.models.signals import post_save
from factory import fuzzy
from apps.users.models import User

from faker import Faker
from faker.providers import internet, misc
from django.db.models.signals import post_save
from apps.api.tokens import encode_token
from apps.users.types import UserModelType
import logging

faker = Faker()
faker.add_provider(internet)
Expand Down
15 changes: 0 additions & 15 deletions core/tests/users/test_models.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,4 @@
from apps.users.models import (
User,
UserBasic,
UserPremium,
Roles,
Friendship,
)
from tests.users.factories import (
UserFactory,
UserBasicFactory,
UserPremiumFactory,
RolesFactory,
FriendshipFactory,
)
import pytest
from apps.api.tokens import encode_token


@pytest.mark.django_db
Expand Down
1 change: 0 additions & 1 deletion core/tests/users/test_users.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@

2 changes: 1 addition & 1 deletion core/tests/users/test_views.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from datetime import datetime, timedelta
from uuid import uuid4

from django.urls import reverse
import pytest
from django.contrib.auth.hashers import check_password, make_password
from django.urls import reverse

pytestmark = pytest.mark.django_db

Expand Down
84 changes: 42 additions & 42 deletions frontend/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
{
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.d.ts", "*.test.ts", "*.test.tsx"],
"parser": "@typescript-eslint/parser"
}
],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"plugins": ["@typescript-eslint", "react-refresh", "import"],
"extends": [
"eslint:recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/recommended",
"plugin:import/typescript",
"plugin:@typescript-eslint/recommended",
"plugin:react-hooks/recommended",
"prettier"
],
"rules": {
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
"no-plusplus": ["error", { "allowForLoopAfterthoughts": true }],
"no-underscore-dangle": 0,
"@typescript-eslint/no-explicit-any": "off"
},
"env": {
"browser": true,
"es2021": true
},
"settings": {
"import/resolver": {
"node": {
"extensions": [".ts", ".tsx", ".d.ts"],
"moduleDirectory": ["src", "node_modules"]
}
}
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.d.ts", "*.test.ts", "*.test.tsx"],
"parser": "@typescript-eslint/parser"
}
],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"plugins": ["@typescript-eslint", "react-refresh", "import"],
"extends": [
"eslint:recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/recommended",
"plugin:import/typescript",
"plugin:@typescript-eslint/recommended",
"plugin:react-hooks/recommended",
"prettier"
],
"rules": {
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
"no-plusplus": ["error", { "allowForLoopAfterthoughts": true }],
"no-underscore-dangle": 0,
"@typescript-eslint/no-explicit-any": "off"
},
"env": {
"browser": true,
"es2021": true
},
"settings": {
"import/resolver": {
"node": {
"extensions": [".ts", ".tsx", ".d.ts"],
"moduleDirectory": ["src", "node_modules"]
}
}
}
}
Loading

0 comments on commit a2e98b6

Please sign in to comment.