-
Notifications
You must be signed in to change notification settings - Fork 0
/
schemas.py
41 lines (26 loc) · 866 Bytes
/
schemas.py
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
from typing import List
from pydantic_sqlalchemy import sqlalchemy_to_pydantic
from pydantic import BaseModel
from .models import Restaurant, Transaction
RestaurantSchema = sqlalchemy_to_pydantic(Restaurant, exclude={"id"})
TransactionSchema = sqlalchemy_to_pydantic(Transaction, exclude={"id"})
class RestaurantResponseSchema(BaseModel):
nome: str
cnpj: str
dono: str
telefone: str
class TransactionResponseSchema(BaseModel):
cliente: str
valor: float
descricao: str
class ListOfTransactionSchema(BaseModel):
estabelecimento: RestaurantResponseSchema = None
recebimentos: List[TransactionResponseSchema] = []
total_recebido: float
class NewTransactionSchema(BaseModel):
estabelecimento: str
cliente: str
valor: float
descricao: str
class ReturnNewTransactionSchema(BaseModel):
aceito: bool