Coverage for bc/kwai-bc-portal/src/kwai_bc_portal/domain/page.py: 100%

13 statements  

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

1"""Module that defines the Page entity.""" 

2 

3from dataclasses import dataclass, field 

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.text import LocaleText 

9from kwai_core.domain.value_objects.traceable_time import TraceableTime 

10 

11from kwai_bc_portal.domain.application import ApplicationEntity 

12 

13 

14class PageIdentifier(IntIdentifier): 

15 """Identifier for a page.""" 

16 

17 

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

19class PageEntity(DataclassEntity): 

20 """A page entity. 

21 

22 Attrs: 

23 enabled: Is this page enabled? 

24 application: The related application. 

25 texts: The text content of the page. 

26 priority: The priority level of the page. 

27 remark: A remark about the page. 

28 traceable_time: The create and update time of the page. 

29 """ 

30 

31 ID: ClassVar[Type] = PageIdentifier 

32 

33 enabled: bool = False 

34 application: ApplicationEntity 

35 texts: tuple[LocaleText, ...] 

36 priority: int 

37 remark: str 

38 traceable_time: TraceableTime = field(default_factory=TraceableTime)