Coverage for fastid / notify / repositories.py: 100%
16 statements
« prev ^ index » next coverage.py v7.13.1, created at 2026-10-18 16:37 +0000
« prev ^ index » next coverage.py v7.13.1, created at 2026-10-18 16:37 +0000
1from typing import Any
3from fastid.database.repository import SQLAlchemyRepository
4from fastid.database.specification import Specification
5from fastid.notify.models import EmailTemplate, Notification, TelegramTemplate
8class EmailTemplateRepository(SQLAlchemyRepository[EmailTemplate]):
9 model_type = EmailTemplate
12class EmailTemplateSlugSpecification(Specification):
13 def __init__(self, slug: str) -> None:
14 self.slug = slug
16 def apply(self, stmt: Any) -> Any:
17 return stmt.where(EmailTemplate.slug == self.slug)
20class TelegramTemplateRepository(SQLAlchemyRepository[TelegramTemplate]):
21 model_type = TelegramTemplate
24class TelegramTemplateSlugSpecification(Specification):
25 def __init__(self, slug: str) -> None:
26 self.slug = slug
28 def apply(self, stmt: Any) -> Any:
29 return stmt.where(TelegramTemplate.slug == self.slug)
32class NotificationRepository(SQLAlchemyRepository[Notification]):
33 model_type = Notification