Coverage for app/ddd/domain/repository/user_repository.py: 100%
18 statements
« prev ^ index » next coverage.py v7.6.10, created at 2025-01-15 01:44 +0000
« prev ^ index » next coverage.py v7.6.10, created at 2025-01-15 01:44 +0000
1from abc import ABCMeta, abstractmethod
3from sqlmodel import Session
5from app.ddd.domain.model import (
6 User,
7 UserId,
8)
11class UserRepository(metaclass=ABCMeta):
12 @abstractmethod
13 def __init__(self, db: Session) -> None:
14 pass
16 @abstractmethod
17 def find_by_id(self, _id: UserId) -> User:
18 raise NotImplementedError
20 @abstractmethod
21 def insert(self, user: User) -> None:
22 raise NotImplementedError
24 @abstractmethod
25 def insert_user_report(self, user: User) -> None:
26 raise NotImplementedError
29 @abstractmethod
30 def update(self, user: User) -> None:
31 raise NotImplementedError
33 @abstractmethod
34 def delete(self, _id: UserId) -> None:
35 raise NotImplementedError
37 @abstractmethod
38 def query(self) -> list[User]:
39 """
40 TODO(nonomura): リポジトリでのメソッドかどうか要検討.
42 多分クエリモデル文脈になるから分けたほうが良いかも
43 """
44 raise NotImplementedError