Skip to content

Commit

Permalink
update tle service
Browse files Browse the repository at this point in the history
  • Loading branch information
JochimMaene committed Jan 23, 2025
1 parent e2615fe commit f87f9c5
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 67 deletions.
14 changes: 3 additions & 11 deletions src/app/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,9 @@ def run_cli() -> NoReturn:
"""
setup_environment()

try:
from litestar.cli.main import litestar_group

sys.exit(litestar_group())
except ImportError as exc:
print( # noqa: T201
"Could not load required libraries. ",
"Please check your installation and make sure you activated any necessary virtual environment",
)
print(exc) # noqa: T201
sys.exit(1)
from litestar.cli.main import litestar_group

sys.exit(litestar_group())


if __name__ == "__main__":
Expand Down
8 changes: 1 addition & 7 deletions src/app/asgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,4 @@ def create_app() -> Litestar:

from app.server.core import ApplicationCore


try:
# Code that should raise an error
return Litestar(plugins=[ApplicationCore()])
except AttributeError as e:
print(f"Error raised: {e}")
return
return Litestar(plugins=[ApplicationCore()])
4 changes: 2 additions & 2 deletions src/app/domain/tle/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from app.domain.tle import controllers, dtos
from . import controllers, schemas, services, urls

__all__ = ["dtos", "controllers"]
__all__ = ("controllers", "schemas", "services", "urls")
29 changes: 0 additions & 29 deletions src/app/domain/tle/dependencies.py

This file was deleted.

11 changes: 0 additions & 11 deletions src/app/domain/tle/repositories.py

This file was deleted.

19 changes: 14 additions & 5 deletions src/app/domain/tle/services.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
from advanced_alchemy.service import SQLAlchemyAsyncRepositoryService
from __future__ import annotations

from app.db.models import TLE
from advanced_alchemy.repository import SQLAlchemyAsyncRepository
from advanced_alchemy.service import SQLAlchemyAsyncRepositoryService

from .repositories import TLERepository
from app.db import models as m

__all__ = ("TLEService",)


class TLEService(SQLAlchemyAsyncRepositoryService[TLE]):
repository_type = TLERepository
class TLEService(SQLAlchemyAsyncRepositoryService[m.TLE]):
"""Handles basic lookup operations for an TLE."""

class Repository(SQLAlchemyAsyncRepository[m.TLE]):
"""TLE Repository."""

model_type = m.TLE

repository_type = Repository
match_fields = ["name"]
4 changes: 2 additions & 2 deletions src/app/lib/deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from __future__ import annotations

import datetime
from datetime import datetime
from typing import (
TYPE_CHECKING,
Any,
Expand Down Expand Up @@ -42,7 +42,7 @@
from sqlalchemy.ext.asyncio import AsyncSession


DTorNone = datetime.datetime | None
DTorNone = datetime | None
StringOrNone = str | None
UuidOrNone = UUID | None
BooleanOrNone = bool | None
Expand Down

0 comments on commit f87f9c5

Please sign in to comment.