From 246f9146af8df80b23bc6bad4ee534d49d320c44 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 16 Sep 2023 10:37:24 +0300 Subject: [PATCH 1/6] Bump docker/bake-action from 3 to 4 (#47) Bumps [docker/bake-action](https://github.com/docker/bake-action) from 3 to 4. - [Release notes](https://github.com/docker/bake-action/releases) - [Commits](https://github.com/docker/bake-action/compare/v3...v4) --- updated-dependencies: - dependency-name: docker/bake-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3d79bc8b..05d26c1e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,7 +32,7 @@ jobs: uses: docker/setup-buildx-action@v2 - name: Build the image - uses: docker/bake-action@v3 + uses: docker/bake-action@v4 with: files: docker-compose.yml targets: web From 7943e5bee0af113720e4e2d52c8a34879eb85a86 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 16 Sep 2023 10:37:32 +0300 Subject: [PATCH 2/6] Bump docker/setup-buildx-action from 2 to 3 (#48) Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 2 to 3. - [Release notes](https://github.com/docker/setup-buildx-action/releases) - [Commits](https://github.com/docker/setup-buildx-action/compare/v2...v3) --- updated-dependencies: - dependency-name: docker/setup-buildx-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 05d26c1e..18fd92be 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,7 +29,7 @@ jobs: uses: docker/setup-qemu-action@v2 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Build the image uses: docker/bake-action@v4 From 3144a56908d732d5b064ca7f7e7cb21c5c61ada0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 16 Sep 2023 10:37:39 +0300 Subject: [PATCH 3/6] Bump docker/setup-qemu-action from 2 to 3 (#49) Bumps [docker/setup-qemu-action](https://github.com/docker/setup-qemu-action) from 2 to 3. - [Release notes](https://github.com/docker/setup-qemu-action/releases) - [Commits](https://github.com/docker/setup-qemu-action/compare/v2...v3) --- updated-dependencies: - dependency-name: docker/setup-qemu-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 18fd92be..0c5751d2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,7 +26,7 @@ jobs: run: cp config/.env.template config/.env - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 From 0c349410526bf02284f06c45988227132b034b03 Mon Sep 17 00:00:00 2001 From: Aleksander Petrushkin Date: Sun, 17 Sep 2023 02:19:25 +0300 Subject: [PATCH 4/6] Fix use method (#69) * fix use deprecated method * fix grammar error --------- Co-authored-by: aapetrushkin --- server/apps/identity/intrastructure/services/placeholder.py | 4 ++-- server/apps/identity/views/user.py | 2 +- server/apps/pictures/models.py | 2 +- server/apps/pictures/views.py | 6 +++--- .../common/django/templates/common/includes/messages.html | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/server/apps/identity/intrastructure/services/placeholder.py b/server/apps/identity/intrastructure/services/placeholder.py index 4944ef4e..bede3f75 100644 --- a/server/apps/identity/intrastructure/services/placeholder.py +++ b/server/apps/identity/intrastructure/services/placeholder.py @@ -17,7 +17,7 @@ class UserResponse(pydantic_model.BaseModel): # TODO: use redis-based caching @final class LeadCreate(http.BaseFetcher): - """Service around creating new users and fething their :term:`lead_id`.""" + """Service around creating new users and fetching their :term:`lead_id`.""" _url_path = '/users' @@ -33,7 +33,7 @@ def __call__( timeout=self._api_timeout, ) response.raise_for_status() - return UserResponse.parse_raw(response.text) + return UserResponse.model_validate_json(response.text) @final diff --git a/server/apps/identity/views/user.py b/server/apps/identity/views/user.py index add5b7ca..c4c19d16 100644 --- a/server/apps/identity/views/user.py +++ b/server/apps/identity/views/user.py @@ -31,7 +31,7 @@ class UserUpdateView(RatelimitMixin, UpdateView[User, UserUpdateForm]): ratelimit_key = 'ip' ratelimit_rate = '10/h' ratelimit_block = True - retelimit_method = ['POST', 'PUT'] # GET is safe + ratelimit_method = ['POST', 'PUT'] # GET is safe def get_object(self, queryset: QuerySet[User] | None = None) -> User: """We only work with the current user.""" diff --git a/server/apps/pictures/models.py b/server/apps/pictures/models.py index 50d4ee20..66aaa9e8 100644 --- a/server/apps/pictures/models.py +++ b/server/apps/pictures/models.py @@ -22,5 +22,5 @@ class FavouritePicture(TimedMixin, models.Model): url = models.URLField() def __str__(self) -> str: - """Beatuful representation.""" + """Beautiful representation.""" return ''.format(self.foreign_id, self.user_id) diff --git a/server/apps/pictures/views.py b/server/apps/pictures/views.py index a52a3b9f..c698fccb 100644 --- a/server/apps/pictures/views.py +++ b/server/apps/pictures/views.py @@ -40,11 +40,11 @@ class DashboardView(CreateView[FavouritePicture, FavouritesForm]): success_url = reverse_lazy('pictures:dashboard') def get_context_data(self, **kwargs: Any) -> dict[str, Any]: - """Innject extra context to template rendering.""" - fetch_puctures = container.instantiate(pictures_fetch.PicturesFetch) + """Inject extra context to template rendering.""" + fetch_pictures = container.instantiate(pictures_fetch.PicturesFetch) context = super().get_context_data(**kwargs) - context['pictures'] = fetch_puctures() # sync http call, may hang + context['pictures'] = fetch_pictures() # sync http call, may hang return context def get_form_kwargs(self) -> dict[str, Any]: diff --git a/server/common/django/templates/common/includes/messages.html b/server/common/django/templates/common/includes/messages.html index 7de6ef34..789614f3 100644 --- a/server/common/django/templates/common/includes/messages.html +++ b/server/common/django/templates/common/includes/messages.html @@ -1,6 +1,6 @@ {% if messages %} {% for message in messages %} - {# We don't have any non-succesful messages just yet #} + {# We don't have any non-successful messages just yet #}

{{ message }}

{% endfor %} {% endif %} From c3bbbff2f2eb2f18f986a3f28f77c706f5e83a82 Mon Sep 17 00:00:00 2001 From: Nikita Sobolev Date: Sun, 17 Sep 2023 09:50:51 +0300 Subject: [PATCH 5/6] Fix import linter (#71) --- .importlinter | 4 ++-- .../identity/{intrastructure => infrastructure}/__init__.py | 0 .../{intrastructure => infrastructure}/django/__init__.py | 0 .../{intrastructure => infrastructure}/django/decorators.py | 0 .../{intrastructure => infrastructure}/django/forms.py | 0 .../{intrastructure => infrastructure}/services/__init__.py | 0 .../services/placeholder.py | 0 server/apps/identity/logic/usecases/user_create_new.py | 2 +- server/apps/identity/logic/usecases/user_update.py | 2 +- server/apps/identity/views/login.py | 4 ++-- server/apps/identity/views/user.py | 2 +- .../pictures/{intrastructure => infrastructure}/__init__.py | 0 .../{intrastructure => infrastructure}/django/__init__.py | 0 .../{intrastructure => infrastructure}/django/forms.py | 0 .../{intrastructure => infrastructure}/services/__init__.py | 0 .../services/placeholder.py | 0 server/apps/pictures/logic/usecases/pictures_fetch.py | 2 +- server/apps/pictures/views.py | 2 +- 18 files changed, 9 insertions(+), 9 deletions(-) rename server/apps/identity/{intrastructure => infrastructure}/__init__.py (100%) rename server/apps/identity/{intrastructure => infrastructure}/django/__init__.py (100%) rename server/apps/identity/{intrastructure => infrastructure}/django/decorators.py (100%) rename server/apps/identity/{intrastructure => infrastructure}/django/forms.py (100%) rename server/apps/identity/{intrastructure => infrastructure}/services/__init__.py (100%) rename server/apps/identity/{intrastructure => infrastructure}/services/placeholder.py (100%) rename server/apps/pictures/{intrastructure => infrastructure}/__init__.py (100%) rename server/apps/pictures/{intrastructure => infrastructure}/django/__init__.py (100%) rename server/apps/pictures/{intrastructure => infrastructure}/django/forms.py (100%) rename server/apps/pictures/{intrastructure => infrastructure}/services/__init__.py (100%) rename server/apps/pictures/{intrastructure => infrastructure}/services/placeholder.py (100%) diff --git a/.importlinter b/.importlinter index 90ae85f7..e4cb4e70 100644 --- a/.importlinter +++ b/.importlinter @@ -16,10 +16,10 @@ containers = layers = (urls) | (admin) (views) - (infrastructure) + (container) (logic) + (infrastructure) (models) - (container) [importlinter:contract:apps-independence] diff --git a/server/apps/identity/intrastructure/__init__.py b/server/apps/identity/infrastructure/__init__.py similarity index 100% rename from server/apps/identity/intrastructure/__init__.py rename to server/apps/identity/infrastructure/__init__.py diff --git a/server/apps/identity/intrastructure/django/__init__.py b/server/apps/identity/infrastructure/django/__init__.py similarity index 100% rename from server/apps/identity/intrastructure/django/__init__.py rename to server/apps/identity/infrastructure/django/__init__.py diff --git a/server/apps/identity/intrastructure/django/decorators.py b/server/apps/identity/infrastructure/django/decorators.py similarity index 100% rename from server/apps/identity/intrastructure/django/decorators.py rename to server/apps/identity/infrastructure/django/decorators.py diff --git a/server/apps/identity/intrastructure/django/forms.py b/server/apps/identity/infrastructure/django/forms.py similarity index 100% rename from server/apps/identity/intrastructure/django/forms.py rename to server/apps/identity/infrastructure/django/forms.py diff --git a/server/apps/identity/intrastructure/services/__init__.py b/server/apps/identity/infrastructure/services/__init__.py similarity index 100% rename from server/apps/identity/intrastructure/services/__init__.py rename to server/apps/identity/infrastructure/services/__init__.py diff --git a/server/apps/identity/intrastructure/services/placeholder.py b/server/apps/identity/infrastructure/services/placeholder.py similarity index 100% rename from server/apps/identity/intrastructure/services/placeholder.py rename to server/apps/identity/infrastructure/services/placeholder.py diff --git a/server/apps/identity/logic/usecases/user_create_new.py b/server/apps/identity/logic/usecases/user_create_new.py index 9aac50e8..8ef5d279 100644 --- a/server/apps/identity/logic/usecases/user_create_new.py +++ b/server/apps/identity/logic/usecases/user_create_new.py @@ -2,7 +2,7 @@ import attr -from server.apps.identity.intrastructure.services import placeholder +from server.apps.identity.infrastructure.services import placeholder from server.apps.identity.models import User from server.common.django.types import Settings diff --git a/server/apps/identity/logic/usecases/user_update.py b/server/apps/identity/logic/usecases/user_update.py index 8100540f..348ed60f 100644 --- a/server/apps/identity/logic/usecases/user_update.py +++ b/server/apps/identity/logic/usecases/user_update.py @@ -2,7 +2,7 @@ import attr -from server.apps.identity.intrastructure.services import placeholder +from server.apps.identity.infrastructure.services import placeholder from server.apps.identity.models import User from server.common.django.types import Settings diff --git a/server/apps/identity/views/login.py b/server/apps/identity/views/login.py index 29d8292c..61ca0931 100644 --- a/server/apps/identity/views/login.py +++ b/server/apps/identity/views/login.py @@ -10,10 +10,10 @@ from ratelimit.mixins import RatelimitMixin from server.apps.identity.container import container -from server.apps.identity.intrastructure.django.decorators import ( +from server.apps.identity.infrastructure.django.decorators import ( redirect_logged_in_users, ) -from server.apps.identity.intrastructure.django.forms import ( +from server.apps.identity.infrastructure.django.forms import ( AuthenticationForm, RegistrationForm, ) diff --git a/server/apps/identity/views/user.py b/server/apps/identity/views/user.py index c4c19d16..fb9ddc19 100644 --- a/server/apps/identity/views/user.py +++ b/server/apps/identity/views/user.py @@ -10,7 +10,7 @@ from ratelimit.mixins import RatelimitMixin from server.apps.identity.container import container -from server.apps.identity.intrastructure.django.forms import UserUpdateForm +from server.apps.identity.infrastructure.django.forms import UserUpdateForm from server.apps.identity.logic.usecases.user_update import UserUpdate from server.apps.identity.models import User from server.common.django.decorators import dispatch_decorator diff --git a/server/apps/pictures/intrastructure/__init__.py b/server/apps/pictures/infrastructure/__init__.py similarity index 100% rename from server/apps/pictures/intrastructure/__init__.py rename to server/apps/pictures/infrastructure/__init__.py diff --git a/server/apps/pictures/intrastructure/django/__init__.py b/server/apps/pictures/infrastructure/django/__init__.py similarity index 100% rename from server/apps/pictures/intrastructure/django/__init__.py rename to server/apps/pictures/infrastructure/django/__init__.py diff --git a/server/apps/pictures/intrastructure/django/forms.py b/server/apps/pictures/infrastructure/django/forms.py similarity index 100% rename from server/apps/pictures/intrastructure/django/forms.py rename to server/apps/pictures/infrastructure/django/forms.py diff --git a/server/apps/pictures/intrastructure/services/__init__.py b/server/apps/pictures/infrastructure/services/__init__.py similarity index 100% rename from server/apps/pictures/intrastructure/services/__init__.py rename to server/apps/pictures/infrastructure/services/__init__.py diff --git a/server/apps/pictures/intrastructure/services/placeholder.py b/server/apps/pictures/infrastructure/services/placeholder.py similarity index 100% rename from server/apps/pictures/intrastructure/services/placeholder.py rename to server/apps/pictures/infrastructure/services/placeholder.py diff --git a/server/apps/pictures/logic/usecases/pictures_fetch.py b/server/apps/pictures/logic/usecases/pictures_fetch.py index 6348a4e2..0861e72d 100644 --- a/server/apps/pictures/logic/usecases/pictures_fetch.py +++ b/server/apps/pictures/logic/usecases/pictures_fetch.py @@ -2,7 +2,7 @@ import attr -from server.apps.pictures.intrastructure.services import placeholder +from server.apps.pictures.infrastructure.services import placeholder from server.common.django.types import Settings diff --git a/server/apps/pictures/views.py b/server/apps/pictures/views.py index c698fccb..eb75a793 100644 --- a/server/apps/pictures/views.py +++ b/server/apps/pictures/views.py @@ -8,7 +8,7 @@ from django.views.generic import CreateView, ListView, TemplateView from server.apps.pictures.container import container -from server.apps.pictures.intrastructure.django.forms import FavouritesForm +from server.apps.pictures.infrastructure.django.forms import FavouritesForm from server.apps.pictures.logic.usecases import favourites_list, pictures_fetch from server.apps.pictures.models import FavouritePicture from server.common.django.decorators import dispatch_decorator From 352aa9b27d17d25f9aa6d67ddb4bec03503ae326 Mon Sep 17 00:00:00 2001 From: Aleksander Petrushkin Date: Sun, 17 Sep 2023 12:23:36 +0300 Subject: [PATCH 6/6] Fix missing call (#72) Co-authored-by: aapetrushkin --- tests/test_server/test_urls.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_server/test_urls.py b/tests/test_server/test_urls.py index 6b59b382..81dc371b 100644 --- a/tests/test_server/test_urls.py +++ b/tests/test_server/test_urls.py @@ -4,7 +4,7 @@ from django.test import Client -@pytest.mark.django_db()() +@pytest.mark.django_db() def test_health_check(client: Client) -> None: """This test ensures that health check is accessible.""" response = client.get('/health/')