-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschemas.py
More file actions
43 lines (33 loc) · 832 Bytes
/
schemas.py
File metadata and controls
43 lines (33 loc) · 832 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
from pydantic import BaseModel
from typing import Optional, List
class UsuarioCreate(BaseModel):
nome: str
email: str
senha: str
ativo: Optional[bool] = True
admin: Optional[bool] = False
class Config:
from_attributes = True
class LoginSchema(BaseModel):
email: str
senha: str
class Config:
from_attributes = True
class OrderSchema(BaseModel):
usuario_id: int
class Config:
from_attributes = True
class OrderItemSchema(BaseModel):
quantidade: int
sabor: str
tamanho: str
preco_unitario: float
class Config:
from_attributes = True
class ResponsePedidoSchema(BaseModel):
id: int
status: str
preco: float
itens: List[OrderItemSchema]
class Config:
from_attributes = True