diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3d79bc8b..0c5751d2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,13 +26,13 @@ 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@v2 + uses: docker/setup-buildx-action@v3 - name: Build the image - uses: docker/bake-action@v3 + uses: docker/bake-action@v4 with: files: docker-compose.yml targets: web 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 91% rename from server/apps/identity/intrastructure/services/placeholder.py rename to server/apps/identity/infrastructure/services/placeholder.py index 4944ef4e..bede3f75 100644 --- a/server/apps/identity/intrastructure/services/placeholder.py +++ b/server/apps/identity/infrastructure/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/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 add5b7ca..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 @@ -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/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/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..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 @@ -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 %} diff --git a/tests/test_server/test_urls.py b/tests/test_server/test_urls.py index 80364485..3695edb5 100644 --- a/tests/test_server/test_urls.py +++ b/tests/test_server/test_urls.py @@ -6,7 +6,7 @@ from plugins.identity.user import ProfileAssertion, ProfileDataFactory -@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/')