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

13 statements  

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

1"""Module that defines a file upload 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.owner import Owner 

9from kwai_core.domain.value_objects.unique_id import UniqueId 

10 

11 

12class FileUploadIdentifier(IntIdentifier): 

13 """Identifier for a file upload.""" 

14 

15 

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

17class FileUploadEntity(DataclassEntity): 

18 """An FileUploadEntity keeps information about a file upload. 

19 

20 Attributes: 

21 uuid: The unique id of the upload. 

22 filename: The name of the file. 

23 owner: The user who uploaded the file. 

24 remark: A remark about the upload. 

25 preview: Whether the upload is a preview. 

26 """ 

27 

28 ID: ClassVar[Type] = FileUploadIdentifier 

29 

30 uuid: UniqueId = field(default_factory=UniqueId.generate) 

31 filename: str 

32 owner: Owner 

33 remark: str = "" 

34 preview: bool = False