bees-knees/prophet/domain/improvement_repo.py
Marty Oehme a8958c76fb
feat: Limit repository get_all to maximum entries
Can simply pass an int and will limit the sql to that amount.
2025-07-22 05:50:41 +02:00

29 lines
819 B
Python

from typing import Protocol
from prophet.domain.improvement import Improvement
class ImprovementNotFoundError(Exception):
pass
class IImprovementRepo(Protocol):
def add(self, improvement: Improvement) -> None:
raise NotImplementedError
def add_all(self, improvements: list[Improvement]) -> None:
raise NotImplementedError
def get(self, id: str) -> Improvement:
raise NotImplementedError
def get_all(self, last_n: int | None = None) -> list[Improvement]:
raise NotImplementedError
def remove(self, id: str) -> Improvement:
"""Returns single deleted improvement"""
raise NotImplementedError
def remove_all(self, ids: list[str]) -> list[Improvement]:
"""Returns list of deleted improvements"""
raise NotImplementedError