moriire commited on
Commit
641b706
1 Parent(s): 1cf701d

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +3 -3
main.py CHANGED
@@ -32,7 +32,7 @@ def read_users(skip: int = 0, limit: int = 100, db: Session = Depends(get_db)):
32
  return users
33
 
34
 
35
- @user_router.get("/users/{user_id}", response_model=schemas.User)
36
  def read_user(user_id: int, db: Session = Depends(get_db)):
37
  db_user = crud.get_user(db, user_id=user_id)
38
  if db_user is None:
@@ -40,14 +40,14 @@ def read_user(user_id: int, db: Session = Depends(get_db)):
40
  return db_user
41
 
42
 
43
- @user_router.post("/users/{user_id}/items/", response_model=schemas.Item)
44
  def create_item_for_user(
45
  user_id: int, item: schemas.ItemCreate, db: Session = Depends(get_db)
46
  ):
47
  return crud.create_user_item(db=db, item=item, user_id=user_id)
48
 
49
 
50
- @user_router.get("/items/", response_model=list[schemas.Item])
51
  def read_items(skip: int = 0, limit: int = 100, db: Session = Depends(get_db)):
52
  items = crud.get_items(db, skip=skip, limit=limit)
53
  return items
 
32
  return users
33
 
34
 
35
+ @user_router.get("/users/{user_id}", response_model=schemas.User, tags=["users"] )
36
  def read_user(user_id: int, db: Session = Depends(get_db)):
37
  db_user = crud.get_user(db, user_id=user_id)
38
  if db_user is None:
 
40
  return db_user
41
 
42
 
43
+ @user_router.post("/users/{user_id}/items/", response_model=schemas.Item, tags=["users"] )
44
  def create_item_for_user(
45
  user_id: int, item: schemas.ItemCreate, db: Session = Depends(get_db)
46
  ):
47
  return crud.create_user_item(db=db, item=item, user_id=user_id)
48
 
49
 
50
+ @user_router.get("/items/", response_model=list[schemas.Item], tags=["users"] )
51
  def read_items(skip: int = 0, limit: int = 100, db: Session = Depends(get_db)):
52
  items = crud.get_items(db, skip=skip, limit=limit)
53
  return items