Skip to content

Commit c9ef759

Browse files
Using prefix
1 parent a1f3085 commit c9ef759

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

app/routers/customer.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,24 @@
1111
)
1212
DELETE_ALL_CUSTOMERS = "TRUNCATE TABLE CUSTOMERS"
1313

14-
router = APIRouter()
14+
router = APIRouter(prefix="/customers", tags=["users"])
1515

1616

17-
@router.get("/customers/", tags=["users"])
17+
@router.get("")
1818
async def read_customers() -> list[Customer]:
1919
rows = await database.fetch_all(query=SELECT_ALL_CUSTOMERS)
2020
customers: list[Customer] = list(map(lambda row: Customer(**dict(row)), rows))
2121
return customers
2222

2323

24-
@router.put("/customers/", status_code=status.HTTP_204_NO_CONTENT, tags=["users"])
24+
@router.put("", status_code=status.HTTP_204_NO_CONTENT, tags=["users"])
2525
async def insert_customers(customers: list[Customer]) -> None:
2626
rows: list[dict[str, Any]] = list(map(lambda customer: vars(customer), customers))
2727
await database.execute_many(query=INSERT_CUSTOMER, values=rows)
2828
return None
2929

3030

31-
@router.delete("/customers/", status_code=status.HTTP_204_NO_CONTENT, tags=["users"])
31+
@router.delete("", status_code=status.HTTP_204_NO_CONTENT, tags=["users"])
3232
async def delete_all_customers() -> None:
3333
await database.execute(query=DELETE_ALL_CUSTOMERS)
3434
return None

0 commit comments

Comments
 (0)