Skip to content

Commit

Permalink
updated sample exercise
Browse files Browse the repository at this point in the history
  • Loading branch information
eadwinCode committed Nov 20, 2024
1 parent d6dd505 commit 33a29c2
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions sample/ellar-and-django-orm/ellar_and_django_orm/root_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
exception_handler,
)
from ellar.core import ModuleBase
from ellar.di import Container
from ellar.di import ProviderConfig

from ellar_django import DjangoModule

Expand All @@ -18,14 +18,12 @@
modules=[
DjangoModule.setup(settings_module="ellar_and_django_orm.wsgi_django.settings"),
EventModule,
]
],
providers=[
ProviderConfig(IEventRepository, use_class="ellar_and_django_orm.services.event_repository:EventRepository")
],
)
class ApplicationModule(ModuleBase):
@exception_handler(404)
def exception_404_handler(cls, ctx: IExecutionContext, exc: Exception) -> Response:
return JSONResponse({"detail": "Resource not found."}, status_code=404)

def register_services(self, container: Container) -> None:
from .services.event_repository import EventRepository

container.register(IEventRepository, EventRepository)

0 comments on commit 33a29c2

Please sign in to comment.