fix: typehint в routes

develop
Сергей Ванюшкин 2024-02-06 15:25:19 +03:00
parent f72c6fe4d7
commit 095ab07ebb
3 changed files with 14 additions and 14 deletions

View File

@ -29,7 +29,7 @@ async def create_dish(
dish_data: DishBase, dish_data: DishBase,
dish: DishService = Depends(), dish: DishService = Depends(),
background_tasks: BackgroundTasks = BackgroundTasks(), background_tasks: BackgroundTasks = BackgroundTasks(),
): ) -> Dish:
return await dish.create_dish( return await dish.create_dish(
menu_id, menu_id,
submenu_id, submenu_id,
@ -44,7 +44,7 @@ async def get_dish(
dish_id: UUID, dish_id: UUID,
dish: DishService = Depends(), dish: DishService = Depends(),
background_tasks: BackgroundTasks = BackgroundTasks(), background_tasks: BackgroundTasks = BackgroundTasks(),
): ) -> Dish:
result = await dish.read_dish( result = await dish.read_dish(
menu_id, menu_id,
submenu_id, submenu_id,
@ -63,7 +63,7 @@ async def update_dish(
dish_data: DishBase, dish_data: DishBase,
dish: DishService = Depends(), dish: DishService = Depends(),
background_tasks: BackgroundTasks = BackgroundTasks(), background_tasks: BackgroundTasks = BackgroundTasks(),
): ) -> Dish:
result = await dish.update_dish( result = await dish.update_dish(
menu_id, menu_id,
submenu_id, submenu_id,
@ -80,5 +80,5 @@ async def delete_dish(
dish_id: UUID, dish_id: UUID,
dish: DishService = Depends(), dish: DishService = Depends(),
background_tasks: BackgroundTasks = BackgroundTasks(), background_tasks: BackgroundTasks = BackgroundTasks(),
): ) -> None:
await dish.del_dish(menu_id, submenu_id, dish_id) await dish.del_dish(menu_id, submenu_id, dish_id)

View File

@ -15,7 +15,7 @@ router = APIRouter(
async def get_menus( async def get_menus(
menu: MenuService = Depends(), menu: MenuService = Depends(),
background_tasks: BackgroundTasks = BackgroundTasks(), background_tasks: BackgroundTasks = BackgroundTasks(),
): ) -> list[MenuRead]:
return await menu.read_menus() return await menu.read_menus()
@ -24,7 +24,7 @@ async def add_menu(
menu: MenuBase, menu: MenuBase,
responce: MenuService = Depends(), responce: MenuService = Depends(),
background_tasks: BackgroundTasks = BackgroundTasks(), background_tasks: BackgroundTasks = BackgroundTasks(),
): ) -> MenuRead:
return await responce.create_menu(menu) return await responce.create_menu(menu)
@ -33,7 +33,7 @@ async def get_menu(
menu_id: UUID, menu_id: UUID,
responce: MenuService = Depends(), responce: MenuService = Depends(),
background_tasks: BackgroundTasks = BackgroundTasks(), background_tasks: BackgroundTasks = BackgroundTasks(),
): ) -> MenuRead:
result = await responce.read_menu(menu_id=menu_id) result = await responce.read_menu(menu_id=menu_id)
if not result: if not result:
@ -47,7 +47,7 @@ async def update_menu(
menu: MenuBase, menu: MenuBase,
responce: MenuService = Depends(), responce: MenuService = Depends(),
background_tasks: BackgroundTasks = BackgroundTasks(), background_tasks: BackgroundTasks = BackgroundTasks(),
): ) -> MenuRead:
result = await responce.update_menu( result = await responce.update_menu(
menu_id=menu_id, menu_id=menu_id,
menu_data=menu, menu_data=menu,
@ -60,5 +60,5 @@ async def delete_menu(
menu_id: UUID, menu_id: UUID,
menu: MenuService = Depends(), menu: MenuService = Depends(),
background_tasks: BackgroundTasks = BackgroundTasks(), background_tasks: BackgroundTasks = BackgroundTasks(),
): ) -> None:
await menu.del_menu(menu_id) await menu.del_menu(menu_id)

View File

@ -16,7 +16,7 @@ async def get_submenus(
menu_id: UUID, menu_id: UUID,
submenu: SubmenuService = Depends(), submenu: SubmenuService = Depends(),
background_tasks: BackgroundTasks = BackgroundTasks(), background_tasks: BackgroundTasks = BackgroundTasks(),
): ) -> list[SubMenuRead]:
result = await submenu.read_submenus(menu_id=menu_id) result = await submenu.read_submenus(menu_id=menu_id)
return result return result
@ -27,7 +27,7 @@ async def create_submenu_item(
submenu_data: MenuBase, submenu_data: MenuBase,
submenu: SubmenuService = Depends(), submenu: SubmenuService = Depends(),
background_tasks: BackgroundTasks = BackgroundTasks(), background_tasks: BackgroundTasks = BackgroundTasks(),
): ) -> SubMenuRead:
result = await submenu.create_submenu( result = await submenu.create_submenu(
menu_id=menu_id, menu_id=menu_id,
submenu_data=submenu_data, submenu_data=submenu_data,
@ -41,7 +41,7 @@ async def get_submenu(
submenu_id: UUID, submenu_id: UUID,
submenu: SubmenuService = Depends(), submenu: SubmenuService = Depends(),
background_tasks: BackgroundTasks = BackgroundTasks(), background_tasks: BackgroundTasks = BackgroundTasks(),
): ) -> SubMenuRead:
result = await submenu.read_menu( result = await submenu.read_menu(
menu_id=menu_id, menu_id=menu_id,
submenu_id=submenu_id, submenu_id=submenu_id,
@ -61,7 +61,7 @@ async def update_submenu(
submenu_data: MenuBase, submenu_data: MenuBase,
submenu: SubmenuService = Depends(), submenu: SubmenuService = Depends(),
background_tasks: BackgroundTasks = BackgroundTasks(), background_tasks: BackgroundTasks = BackgroundTasks(),
): ) -> SubMenuRead:
result = await submenu.update_submenu( result = await submenu.update_submenu(
menu_id=menu_id, menu_id=menu_id,
submenu_id=submenu_id, submenu_id=submenu_id,
@ -76,5 +76,5 @@ async def delete_submenu(
submenu_id: UUID, submenu_id: UUID,
submenu: SubmenuService = Depends(), submenu: SubmenuService = Depends(),
background_tasks: BackgroundTasks = BackgroundTasks(), background_tasks: BackgroundTasks = BackgroundTasks(),
): ) -> None:
await submenu.del_menu(menu_id=menu_id, submenu_id=submenu_id) await submenu.del_menu(menu_id=menu_id, submenu_id=submenu_id)