jcnok commited on
Commit
ed4760e
·
verified ·
1 Parent(s): 54fcb0b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -199,10 +199,10 @@ async def get_sales_per_month(ano: int):
199
 
200
 
201
  # Endpoint para obter as Vendas por Ano
202
- @app.get("/sales_per_year/{ano}") # Adiciona o parâmetro 'ano'
203
  async def get_sales_per_year(ano: int):
204
  with engine.connect() as conn:
205
- results = conn.execute(text(f"SELECT * FROM sales_per_year WHERE sales_year = {ano}")).fetchall()
206
  if results:
207
  return [{"sales_year": row[0], "sales_per_year": row[1]} for row in results]
208
  else:
@@ -238,10 +238,10 @@ async def get_revenue_per_month(ano: int):
238
 
239
 
240
  # Endpoint para obter o Faturamento por Ano
241
- @app.get("/revenue_per_year/{ano}") # Adiciona o parâmetro 'ano'
242
  async def get_revenue_per_year(ano: int):
243
  with engine.connect() as conn:
244
- results = conn.execute(text(f"SELECT * FROM revenue_per_year WHERE revenue_year = {ano}")).fetchall()
245
  if results:
246
  return [
247
  {"revenue_year": row[0], "revenue_per_year": row[1]} for row in results
 
199
 
200
 
201
  # Endpoint para obter as Vendas por Ano
202
+ @app.get("/sales_per_year") # Adiciona o parâmetro 'ano'
203
  async def get_sales_per_year(ano: int):
204
  with engine.connect() as conn:
205
+ results = conn.execute(text(f"SELECT * FROM sales_per_year")).fetchall()
206
  if results:
207
  return [{"sales_year": row[0], "sales_per_year": row[1]} for row in results]
208
  else:
 
238
 
239
 
240
  # Endpoint para obter o Faturamento por Ano
241
+ @app.get("/revenue_per_year") # Adiciona o parâmetro 'ano'
242
  async def get_revenue_per_year(ano: int):
243
  with engine.connect() as conn:
244
+ results = conn.execute(text(f"SELECT * FROM revenue_per_year")).fetchall()
245
  if results:
246
  return [
247
  {"revenue_year": row[0], "revenue_per_year": row[1]} for row in results