We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6df4787 commit 9b25bfcCopy full SHA for 9b25bfc
app/routers/customer.py
@@ -9,6 +9,7 @@
9
INSERT_CUSTOMER = (
10
"INSERT INTO CUSTOMERS(FIRST_NAME, LAST_NAME) VALUES (:first_name, :last_name)"
11
)
12
+DELETE_ALL_CUSTOMERS = "TRUNCATE TABLE CUSTOMERS"
13
14
router = APIRouter()
15
@@ -25,3 +26,9 @@ async def insert_customers(customers: list[Customer]) -> None:
25
26
rows: list[dict[str, Any]] = list(map(lambda customer: vars(customer), customers))
27
await database.execute_many(query=INSERT_CUSTOMER, values=rows)
28
return None
29
+
30
31
+@router.delete("/customers/", status_code=status.HTTP_204_NO_CONTENT, tags=["users"])
32
+async def delete_all_customers() -> None:
33
+ await database.execute(query=DELETE_ALL_CUSTOMERS)
34
+ return None
0 commit comments