Coverage for app / schemas.py: 100%

37 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-03-26 21:50 +0000

1from pydantic import BaseModel, ConfigDict 

2from typing import List, Optional 

3from datetime import datetime 

4 

5 

6class TaskCreate(BaseModel): 

7 user_id: int 

8 title: str 

9 description: str = None 

10 importance: int = 0 

11 length: int = 0 

12 tags: List[str] = [] 

13 due_at: datetime 

14 reminder_enabled: bool = False 

15 

16class SubtaskResponse(BaseModel): 

17 id: int 

18 task_id: int 

19 title: str 

20 order_index: int | None 

21 completed: bool 

22 created_at: datetime 

23 updated_at: datetime 

24 

25 model_config = ConfigDict(from_attributes=True) 

26 

27class TaskResponse(BaseModel): 

28 id: int 

29 user_id: int 

30 title: str # The title of the task 

31 description: Optional[str] = None # A short description of the task 

32 completed: bool # Whether or not the task is complete 

33 importance: int # How important the task is (scale from 1-10) 

34 length: int # How many minuites this will take (<5 - 300) 

35 tags: List[str] = ( 

36 [] 

37 ) # A list of string tags (can be []). No longer than 50 chars per tag 

38 due_at: datetime # The date that this must be completed by 

39 reference_url: Optional[str] = None 

40 priority: float # Determines the task priority score 

41 created_at: datetime 

42 updated_at: datetime 

43 subtasks: List[SubtaskResponse] = [] 

44 

45 model_config = ConfigDict(from_attributes=True) 

46