Coverage for app/ddd/domain/model/group.py: 100%

16 statements  

« prev     ^ index     » next       coverage.py v7.6.10, created at 2025-01-15 01:44 +0000

1# from app.ddd.domain.factory import UserReportFactory 

2 

3import uuid 

4from datetime import datetime 

5 

6from pydantic import Field 

7 

8from app.core.base import BaseEntity, BaseValueObject 

9from app.ddd.domain.model.user import User 

10 

11 

12class GroupId(BaseValueObject): 

13 root: str 

14 

15class Group(BaseEntity): 

16 group_id: str= Field(default_factory=lambda: str(uuid.uuid4())) # デフォルトでアプリID採番 

17 group_name: str 

18 

19 group_responsible_user_id: str 

20 

21 group_users: list[User] = Field(default=[]) 

22 

23 created_at: datetime | None = None 

24 updated_at: datetime | None = None 

25 

26 # users: list[User] = Field([]) 

27 

28 def _id(self) -> str: 

29 return self.group_id 

30 

31 # def add_report(self, **kwargs: Mapping[str, Any]) -> UserReport: 

32 # user_report = UserReport( 

33 # created_user_id = self.user_id, 

34 # **kwargs 

35 # ) 

36 # self.user_reports.append(user_report) 

37 # return user_report 

38 

39 

40