@@ -7,44 +7,45 @@ def handler(event, context):
77from fastapi import FastAPI , HTTPException
88from pydantic import BaseModel , Field
99from mangum import Mangum
10+ import boto3
11+ from boto3 .dynamodb .conditions import Key
1012
13+ # api = FastAPI()
14+ # handler = Mangum(api)
1115
12- api = FastAPI ()
13- handler = Mangum (api )
16+ # class Priority(IntEnum):
17+ # LOW = 3
18+ # MEDIUM = 2
19+ # HIGH = 1
1420
15- class Priority ( IntEnum ):
16- LOW = 3
17- MEDIUM = 2
18- HIGH = 1
21+ # class TodoBase(BaseModel ):
22+ # title: str = Field(..., min_length=3, max_length=50, description="Título da tarefa")
23+ # done: bool = Field(default=False, description="Tarefa concluída ou não")
24+ # priority: Priority = Field(default=Priority.LOW, description="Prioridade da tarefa")
1925
20- class TodoBase (BaseModel ):
21- title : str = Field (..., min_length = 3 , max_length = 50 , description = "Título da tarefa" )
22- done : bool = Field (default = False , description = "Tarefa concluída ou não" )
23- priority : Priority = Field (default = Priority .LOW , description = "Prioridade da tarefa" )
26+ # class TodoCreate(TodoBase):
27+ # pass
2428
25- class TodoCreate (TodoBase ):
26- pass
29+ # class Todo (TodoBase):
30+ # id: int = Field(..., description="Identificador da tarefa")
2731
28- class Todo (TodoBase ):
29- id : int = Field (..., description = "Identificador da tarefa" )
32+ # class TodoUpdate(BaseModel):
33+ # title: Optional[str] = Field(None, min_length=3, max_length=50, description="Título da tarefa")
34+ # done: Optional[bool] = Field(None, description="Tarefa concluída ou não")
35+ # priority: Optional[Priority] = Field(None, description="Prioridade da tarefa")
3036
31- class TodoUpdate (BaseModel ):
32- title : Optional [str ] = Field (None , min_length = 3 , max_length = 50 , description = "Título da tarefa" )
33- done : Optional [bool ] = Field (None , description = "Tarefa concluída ou não" )
34- priority : Optional [Priority ] = Field (None , description = "Prioridade da tarefa" )
35-
36- all_todos = [
37- Todo (id = 1 , title = "Fazer compras" , done = False , priority = Priority .HIGH ),
38- Todo (id = 2 , title = "Estudar FastAPI" , done = False , priority = Priority .MEDIUM ),
39- Todo (id = 3 , title = "Estudar Python" , done = False , priority = Priority .MEDIUM ),s
40- Todo (id = 4 , title = "Estudar Django" , done = False , priority = Priority .HIGH ),
41- Todo (id = 5 , title = "Estudar Flask" , done = False , priority = Priority .LOW ),
42- ]
37+ # all_todos = [
38+ # Todo(id=1, title="Fazer compras", done=False, priority=Priority.HIGH),
39+ # Todo(id=2, title="Estudar FastAPI", done=False, priority=Priority.MEDIUM),
40+ # Todo(id=3, title="Estudar Python", done=False, priority=Priority.MEDIUM),
41+ # Todo(id=4, title="Estudar Django", done=False, priority=Priority.HIGH),
42+ # Todo(id=5, title="Estudar Flask", done=False, priority=Priority.LOW),
43+ # ]
4344
4445
4546# @api.get("/")
4647# def index():
47- # return { "message": "Olá atlantico "}
48+ # return { "message": "Olá ascanianos "}
4849
4950# @api.get('/todos',response_model=List[Todo])
5051# def get_todos():
0 commit comments