Coverage for src / lexigram / contracts / admin / repository.py: 100%
6 statements
« prev ^ index » next coverage.py v7.13.5, created at 2026-08-15 18:58 +0800
« prev ^ index » next coverage.py v7.13.5, created at 2026-08-15 18:58 +0800
1"""AdminRepositoryProtocol — generic admin CRUD repository."""
3from __future__ import annotations
5from typing import Any, Protocol, TypeVar, runtime_checkable
7T = TypeVar("T")
10@runtime_checkable
11class AdminRepositoryProtocol(Protocol[T]):
12 """Protocol for admin repository operations."""
14 async def find_many(
15 self,
16 *,
17 offset: int = 0,
18 limit: int = 20,
19 order_by: list[tuple[str, str]] | None = None,
20 filters: dict[str, Any] | None = None,
21 search: str | None = None,
22 search_fields: list[str] | None = None,
23 load: list[str] | None = None,
24 ) -> list[T]: ...
26 async def find_by_id(self, item_id: Any) -> T | None: ...
28 async def count(
29 self,
30 *,
31 filters: dict[str, Any] | None = None,
32 search: str | None = None,
33 search_fields: list[str] | None = None,
34 ) -> int: ...
36 async def create(self, data: dict[str, Any]) -> T: ...
38 async def update(self, item_id: Any, data: dict[str, Any]) -> T: ...
40 async def delete(self, item_id: Any) -> bool: ...
43__all__ = ["AdminRepositoryProtocol"]