Add Pydantic models for Goal Tracker module
Browse files
modules/goal_tracker/models.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from pydantic import BaseModel
|
| 2 |
+
from typing import Optional
|
| 3 |
+
from datetime import datetime
|
| 4 |
+
|
| 5 |
+
class GoalBase(BaseModel):
|
| 6 |
+
title: str
|
| 7 |
+
description: Optional[str] = ""
|
| 8 |
+
target_date: Optional[datetime] = None
|
| 9 |
+
|
| 10 |
+
class GoalCreate(GoalBase):
|
| 11 |
+
pass
|
| 12 |
+
|
| 13 |
+
class GoalUpdate(GoalBase):
|
| 14 |
+
title: Optional[str] = None
|
| 15 |
+
|
| 16 |
+
class GoalInDB(GoalBase):
|
| 17 |
+
id: str
|
| 18 |
+
user_id: str
|
| 19 |
+
created_at: datetime
|
| 20 |
+
updated_at: datetime
|
| 21 |
+
|
| 22 |
+
class GoalList(BaseModel):
|
| 23 |
+
goals: list[GoalInDB]
|