Spaces:
Sleeping
Sleeping
Update app/models.py
Browse files- app/models.py +19 -0
app/models.py
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from pydantic import BaseModel, Field
|
| 2 |
+
from typing import Optional
|
| 3 |
+
from datetime import datetime
|
| 4 |
+
|
| 5 |
+
class Task(BaseModel):
|
| 6 |
+
id: Optional[int] = None
|
| 7 |
+
title: str = Field(..., min_length=1, max_length=100, description="Título da tarefa")
|
| 8 |
+
description: Optional[str] = Field(None, max_length=500, description="Descrição detalhada")
|
| 9 |
+
completed: bool = Field(default=False, description="Status de conclusão")
|
| 10 |
+
created_at: Optional[datetime] = None
|
| 11 |
+
|
| 12 |
+
class Config:
|
| 13 |
+
json_schema_extra = {
|
| 14 |
+
"example": {
|
| 15 |
+
"title": "Aprender FastAPI",
|
| 16 |
+
"description": "Completar o bootcamp de FastAPI com Docker",
|
| 17 |
+
"completed": False
|
| 18 |
+
}
|
| 19 |
+
}
|