6
6
router = APIRouter ()
7
7
8
8
9
- @router .get ("/items/ " , response_model = list [Item ], tags = [ "items" ], operation_id = "list_items" )
9
+ @router .get ("/" , response_model = list [Item ], operation_id = "list_items" )
10
10
async def list_items (skip : int = 0 , limit : int = 10 ):
11
11
"""
12
12
List all items in the database.
@@ -16,7 +16,7 @@ async def list_items(skip: int = 0, limit: int = 10):
16
16
return list (items_db .values ())[skip : skip + limit ]
17
17
18
18
19
- @router .get ("/items/ {item_id}" , response_model = Item , tags = [ "items" ] , operation_id = "get_item" )
19
+ @router .get ("/{item_id}" , response_model = Item , operation_id = "get_item" )
20
20
async def read_item (item_id : int ):
21
21
"""
22
22
Get a specific item by its ID.
@@ -28,7 +28,7 @@ async def read_item(item_id: int):
28
28
return items_db [item_id ]
29
29
30
30
31
- @router .post ("/items/ " , response_model = Item , tags = [ "items" ] , operation_id = "create_item" )
31
+ @router .post ("/" , response_model = Item , operation_id = "create_item" )
32
32
async def create_item (item : Item ):
33
33
"""
34
34
Create a new item in the database.
@@ -39,7 +39,7 @@ async def create_item(item: Item):
39
39
return item
40
40
41
41
42
- @router .put ("/items/ {item_id}" , response_model = Item , tags = [ "items" ] , operation_id = "update_item" )
42
+ @router .put ("/{item_id}" , response_model = Item , operation_id = "update_item" )
43
43
async def update_item (item_id : int , item : Item ):
44
44
"""
45
45
Update an existing item.
@@ -54,7 +54,7 @@ async def update_item(item_id: int, item: Item):
54
54
return item
55
55
56
56
57
- @router .delete ("/items/ {item_id}" , tags = [ "items" ] , operation_id = "delete_item" )
57
+ @router .delete ("/{item_id}" , operation_id = "delete_item" )
58
58
async def delete_item (item_id : int ):
59
59
"""
60
60
Delete an item from the database.
@@ -68,7 +68,7 @@ async def delete_item(item_id: int):
68
68
return {"message" : "Item deleted successfully" }
69
69
70
70
71
- @router .get ("/items/ search/" , response_model = list [Item ], tags = ["search" ], operation_id = "search_items" )
71
+ @router .get ("/search/" , response_model = list [Item ], tags = ["search" ], operation_id = "search_items" )
72
72
async def search_items (
73
73
q : str | None = Query (None , description = "Search query string" ),
74
74
min_price : float | None = Query (None , description = "Minimum price" ),
0 commit comments