Init project

This commit is contained in:
2026-01-15 09:47:43 +03:00
commit 3e515c66ec
59 changed files with 5101 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
import asyncio
import typer
from .service import NotificationsService
from .settings import NotificationsSettings
def callback(ctx: typer.Context):
ctx.obj["settings"] = ctx.obj["settings"].notifications
def run(ctx: typer.Context):
settings: NotificationsSettings = ctx.obj["settings"]
repositories_container: RepositoriesContainer = ctx.obj["repositories_container"]
service = NotificationsService(
settings=settings,
repositories_container=repositories_container,
)
asyncio.run(service.run())
def run_once(ctx: typer.Context):
settings: NotificationsSettings = ctx.obj["settings"]
repositories_container: RepositoriesContainer = ctx.obj["repositories_container"]
service = NotificationsService(
settings=settings,
repositories_container=repositories_container,
)
asyncio.run(service.send_notifications())
def get_cli() -> typer.Typer:
cli = typer.Typer()
cli.callback()(callback)
cli.command(name="run")(run)
cli.command(name="run-once")(run_once)
return cli