fix: typehint в routes
parent
f72c6fe4d7
commit
095ab07ebb
|
@ -29,7 +29,7 @@ async def create_dish(
|
|||
dish_data: DishBase,
|
||||
dish: DishService = Depends(),
|
||||
background_tasks: BackgroundTasks = BackgroundTasks(),
|
||||
):
|
||||
) -> Dish:
|
||||
return await dish.create_dish(
|
||||
menu_id,
|
||||
submenu_id,
|
||||
|
@ -44,7 +44,7 @@ async def get_dish(
|
|||
dish_id: UUID,
|
||||
dish: DishService = Depends(),
|
||||
background_tasks: BackgroundTasks = BackgroundTasks(),
|
||||
):
|
||||
) -> Dish:
|
||||
result = await dish.read_dish(
|
||||
menu_id,
|
||||
submenu_id,
|
||||
|
@ -63,7 +63,7 @@ async def update_dish(
|
|||
dish_data: DishBase,
|
||||
dish: DishService = Depends(),
|
||||
background_tasks: BackgroundTasks = BackgroundTasks(),
|
||||
):
|
||||
) -> Dish:
|
||||
result = await dish.update_dish(
|
||||
menu_id,
|
||||
submenu_id,
|
||||
|
@ -80,5 +80,5 @@ async def delete_dish(
|
|||
dish_id: UUID,
|
||||
dish: DishService = Depends(),
|
||||
background_tasks: BackgroundTasks = BackgroundTasks(),
|
||||
):
|
||||
) -> None:
|
||||
await dish.del_dish(menu_id, submenu_id, dish_id)
|
||||
|
|
|
@ -15,7 +15,7 @@ router = APIRouter(
|
|||
async def get_menus(
|
||||
menu: MenuService = Depends(),
|
||||
background_tasks: BackgroundTasks = BackgroundTasks(),
|
||||
):
|
||||
) -> list[MenuRead]:
|
||||
return await menu.read_menus()
|
||||
|
||||
|
||||
|
@ -24,7 +24,7 @@ async def add_menu(
|
|||
menu: MenuBase,
|
||||
responce: MenuService = Depends(),
|
||||
background_tasks: BackgroundTasks = BackgroundTasks(),
|
||||
):
|
||||
) -> MenuRead:
|
||||
return await responce.create_menu(menu)
|
||||
|
||||
|
||||
|
@ -33,7 +33,7 @@ async def get_menu(
|
|||
menu_id: UUID,
|
||||
responce: MenuService = Depends(),
|
||||
background_tasks: BackgroundTasks = BackgroundTasks(),
|
||||
):
|
||||
) -> MenuRead:
|
||||
result = await responce.read_menu(menu_id=menu_id)
|
||||
|
||||
if not result:
|
||||
|
@ -47,7 +47,7 @@ async def update_menu(
|
|||
menu: MenuBase,
|
||||
responce: MenuService = Depends(),
|
||||
background_tasks: BackgroundTasks = BackgroundTasks(),
|
||||
):
|
||||
) -> MenuRead:
|
||||
result = await responce.update_menu(
|
||||
menu_id=menu_id,
|
||||
menu_data=menu,
|
||||
|
@ -60,5 +60,5 @@ async def delete_menu(
|
|||
menu_id: UUID,
|
||||
menu: MenuService = Depends(),
|
||||
background_tasks: BackgroundTasks = BackgroundTasks(),
|
||||
):
|
||||
) -> None:
|
||||
await menu.del_menu(menu_id)
|
||||
|
|
|
@ -16,7 +16,7 @@ async def get_submenus(
|
|||
menu_id: UUID,
|
||||
submenu: SubmenuService = Depends(),
|
||||
background_tasks: BackgroundTasks = BackgroundTasks(),
|
||||
):
|
||||
) -> list[SubMenuRead]:
|
||||
result = await submenu.read_submenus(menu_id=menu_id)
|
||||
return result
|
||||
|
||||
|
@ -27,7 +27,7 @@ async def create_submenu_item(
|
|||
submenu_data: MenuBase,
|
||||
submenu: SubmenuService = Depends(),
|
||||
background_tasks: BackgroundTasks = BackgroundTasks(),
|
||||
):
|
||||
) -> SubMenuRead:
|
||||
result = await submenu.create_submenu(
|
||||
menu_id=menu_id,
|
||||
submenu_data=submenu_data,
|
||||
|
@ -41,7 +41,7 @@ async def get_submenu(
|
|||
submenu_id: UUID,
|
||||
submenu: SubmenuService = Depends(),
|
||||
background_tasks: BackgroundTasks = BackgroundTasks(),
|
||||
):
|
||||
) -> SubMenuRead:
|
||||
result = await submenu.read_menu(
|
||||
menu_id=menu_id,
|
||||
submenu_id=submenu_id,
|
||||
|
@ -61,7 +61,7 @@ async def update_submenu(
|
|||
submenu_data: MenuBase,
|
||||
submenu: SubmenuService = Depends(),
|
||||
background_tasks: BackgroundTasks = BackgroundTasks(),
|
||||
):
|
||||
) -> SubMenuRead:
|
||||
result = await submenu.update_submenu(
|
||||
menu_id=menu_id,
|
||||
submenu_id=submenu_id,
|
||||
|
@ -76,5 +76,5 @@ async def delete_submenu(
|
|||
submenu_id: UUID,
|
||||
submenu: SubmenuService = Depends(),
|
||||
background_tasks: BackgroundTasks = BackgroundTasks(),
|
||||
):
|
||||
) -> None:
|
||||
await submenu.del_menu(menu_id=menu_id, submenu_id=submenu_id)
|
||||
|
|
Loading…
Reference in New Issue