Coverage for src/qdrant_loader/connectors/jira/models.py: 100%

39 statements  

« prev     ^ index     » next       coverage.py v7.8.2, created at 2025-06-04 05:50 +0000

1"""Data models for Jira connector.""" 

2 

3from datetime import datetime 

4 

5from pydantic import BaseModel, Field, HttpUrl 

6 

7 

8class JiraUser(BaseModel): 

9 """Jira user model.""" 

10 

11 account_id: str = Field(..., description="User's account ID") 

12 display_name: str = Field(..., description="User's display name") 

13 email_address: str | None = Field(None, description="User's email address") 

14 

15 

16class JiraComment(BaseModel): 

17 """Jira comment model.""" 

18 

19 id: str = Field(..., description="Comment ID") 

20 body: str = Field(..., description="Comment content") 

21 created: datetime = Field(..., description="Comment creation timestamp") 

22 updated: datetime | None = Field(None, description="Comment last update timestamp") 

23 author: JiraUser = Field(..., description="User who created the comment") 

24 

25 

26class JiraAttachment(BaseModel): 

27 """Jira attachment model.""" 

28 

29 id: str = Field(..., description="Attachment ID") 

30 filename: str = Field(..., description="Attachment filename") 

31 size: int = Field(..., description="Attachment size in bytes") 

32 mime_type: str = Field(..., description="Attachment MIME type") 

33 content_url: HttpUrl = Field(..., description="URL to download attachment content") 

34 created: datetime = Field(..., description="Attachment creation timestamp") 

35 author: JiraUser = Field(..., description="User who attached the file") 

36 

37 

38class JiraIssue(BaseModel): 

39 """Jira issue model.""" 

40 

41 id: str = Field(..., description="Issue ID") 

42 key: str = Field(..., description="Issue key") 

43 summary: str = Field(..., description="Issue summary") 

44 description: str | None = Field(None, description="Issue description") 

45 issue_type: str = Field(..., description="Issue type") 

46 status: str = Field(..., description="Issue status") 

47 priority: str | None = Field(None, description="Issue priority") 

48 project_key: str = Field(..., description="Project key") 

49 created: datetime = Field(..., description="Issue creation timestamp") 

50 updated: datetime = Field(..., description="Last update timestamp") 

51 reporter: JiraUser = Field(..., description="Issue reporter") 

52 assignee: JiraUser | None = Field(None, description="Issue assignee") 

53 labels: list[str] = Field(default_factory=list, description="Issue labels") 

54 attachments: list[JiraAttachment] = Field( 

55 default_factory=list, description="Issue attachments" 

56 ) 

57 comments: list[JiraComment] = Field( 

58 default_factory=list, description="Issue comments" 

59 ) 

60 parent_key: str | None = Field(None, description="Parent issue key for subtasks") 

61 subtasks: list[str] = Field( 

62 default_factory=list, description="List of subtask keys" 

63 ) 

64 linked_issues: list[str] = Field( 

65 default_factory=list, description="List of linked issue keys" 

66 )