sdacelo commited on
Commit
20ace2f
·
1 Parent(s): e538957

update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -6
app.py CHANGED
@@ -48,7 +48,6 @@ class Payment(BaseModel):
48
  def home():
49
  return {"Hello": "Cali"}
50
 
51
- # Grouped under 'Customers'
52
  @app.get("/customers/", response_model=List[Customer], summary="Get all customers", description="Retrieves a list of all customers.", tags=["Customers"])
53
  def get_customers():
54
  return efd.customers
@@ -62,27 +61,23 @@ def get_customer_by_id(customer_id: str):
62
 
63
  return customer
64
 
65
- # Grouped under 'Products'
66
  @app.get("/products/", response_model=List[Product], summary="Get all products", description="Returns a list of all products.", tags=["Products"])
67
  def get_products():
68
  return efd.products
69
 
70
- # Grouped under 'Sellers'
71
  @app.get("/sellers/", response_model=List[Seller], summary="Get all sellers", description="Returns a list of all sellers.", tags=["Sellers"])
72
  def get_sellers():
73
  return efd.sellers
74
 
75
- # Grouped under 'Orders'
76
  @app.get("/orders/", response_model=List[Order], summary="Get all orders", description="Returns a list of all orders placed.", tags=["Orders"])
77
  def get_orders():
78
  return efd.orders
79
 
80
- # Grouped under 'Payments'
81
  @app.get("/payments/", response_model=List[Payment], summary="Get all payments", description="Returns a list of all payments made.", tags=["Payments"])
82
  def get_payments():
83
  return efd.payments
84
 
85
- # POST
86
  @app.post("/customers/", summary="Add a customer", description="Allows you to add a new customer to the customers list.", tags=["Customers"])
87
  def create_customer(customer: Customer):
88
  efd.customers.append(customer.model_dump())
 
48
  def home():
49
  return {"Hello": "Cali"}
50
 
 
51
  @app.get("/customers/", response_model=List[Customer], summary="Get all customers", description="Retrieves a list of all customers.", tags=["Customers"])
52
  def get_customers():
53
  return efd.customers
 
61
 
62
  return customer
63
 
 
64
  @app.get("/products/", response_model=List[Product], summary="Get all products", description="Returns a list of all products.", tags=["Products"])
65
  def get_products():
66
  return efd.products
67
 
 
68
  @app.get("/sellers/", response_model=List[Seller], summary="Get all sellers", description="Returns a list of all sellers.", tags=["Sellers"])
69
  def get_sellers():
70
  return efd.sellers
71
 
 
72
  @app.get("/orders/", response_model=List[Order], summary="Get all orders", description="Returns a list of all orders placed.", tags=["Orders"])
73
  def get_orders():
74
  return efd.orders
75
 
 
76
  @app.get("/payments/", response_model=List[Payment], summary="Get all payments", description="Returns a list of all payments made.", tags=["Payments"])
77
  def get_payments():
78
  return efd.payments
79
 
80
+ # Post
81
  @app.post("/customers/", summary="Add a customer", description="Allows you to add a new customer to the customers list.", tags=["Customers"])
82
  def create_customer(customer: Customer):
83
  efd.customers.append(customer.model_dump())