Coverage for bc/kwai-bc-club/src/kwai_bc_club/domain/person.py: 100%

13 statements  

« prev     ^ index     » next       coverage.py v7.11.0, created at 2024-01-01 00:00 +0000

1"""Module that defines an entity for a person.""" 

2 

3from dataclasses import dataclass 

4from typing import ClassVar, Type 

5 

6from kwai_core.domain.entity import DataclassEntity 

7from kwai_core.domain.value_objects.identifier import IntIdentifier 

8from kwai_core.domain.value_objects.name import Name 

9 

10from kwai_bc_club.domain.contact import ContactEntity 

11from kwai_bc_club.domain.country import CountryEntity 

12from kwai_bc_club.domain.value_objects import Birthdate, Gender 

13 

14 

15class PersonIdentifier(IntIdentifier): 

16 """Identifier for a person.""" 

17 

18 

19@dataclass(kw_only=True, eq=False, slots=True, frozen=True) 

20class PersonEntity(DataclassEntity): 

21 """A person entity. 

22 

23 Attributes: 

24 name: The name of the person. 

25 gender: The gender of the person. 

26 birthdate: The birthdate of the person. 

27 nationality: The nationality of the person. 

28 contact: The related contact entity. 

29 remark: A remark about the person. 

30 """ 

31 

32 ID: ClassVar[Type] = PersonIdentifier 

33 

34 name: Name 

35 gender: Gender 

36 birthdate: Birthdate 

37 nationality: CountryEntity 

38 contact: ContactEntity 

39 remark: str = ""