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
« prev ^ index » next coverage.py v7.6.10, created at 2025-01-15 01:44 +0000
1# from app.ddd.domain.factory import UserReportFactory
3import uuid
4from datetime import datetime
6from pydantic import Field
8from app.core.base import BaseEntity, BaseValueObject
9from app.ddd.domain.model.user import User
12class GroupId(BaseValueObject):
13 root: str
15class Group(BaseEntity):
16 group_id: str= Field(default_factory=lambda: str(uuid.uuid4())) # デフォルトでアプリID採番
17 group_name: str
19 group_responsible_user_id: str
21 group_users: list[User] = Field(default=[])
23 created_at: datetime | None = None
24 updated_at: datetime | None = None
26 # users: list[User] = Field([])
28 def _id(self) -> str:
29 return self.group_id
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