jonathanjordan21 commited on
Commit
5add6b6
·
verified ·
1 Parent(s): 04adfa1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -1,6 +1,8 @@
1
  from fastapi import FastAPI
2
  from pydantic import BaseModel
3
 
 
 
4
  app = FastAPI()
5
 
6
  # Define the ticket schema using Pydantic
@@ -20,7 +22,9 @@ def greet_json():
20
  async def create_ticket(ticket: Ticket):
21
  # Here you can process the ticket, e.g., save it to a database.
22
  # For now, we simply return the received ticket data.
 
 
23
  return {
24
  "message": "Ticket created successfully",
25
- "ticket": ticket.dict()
26
  }
 
1
  from fastapi import FastAPI
2
  from pydantic import BaseModel
3
 
4
+ import random
5
+
6
  app = FastAPI()
7
 
8
  # Define the ticket schema using Pydantic
 
22
  async def create_ticket(ticket: Ticket):
23
  # Here you can process the ticket, e.g., save it to a database.
24
  # For now, we simply return the received ticket data.
25
+ tick = ticket.dict()
26
+ tick["number"] = random.randint(1000, 9999)
27
  return {
28
  "message": "Ticket created successfully",
29
+ "ticket": tick
30
  }