From 2307637c804365612f90567013bc891a016428e2 Mon Sep 17 00:00:00 2001 From: ronis_0505 Date: Thu, 25 Sep 2025 22:44:59 +0300 Subject: [PATCH] separate FSM --- app/FSM/__init__.py | 4 ++++ app/FSM/states.py | 24 ++++++++++++++++++++++++ app/handlers/orders.py | 18 ------------------ 3 files changed, 28 insertions(+), 18 deletions(-) create mode 100644 app/FSM/__init__.py create mode 100644 app/FSM/states.py diff --git a/app/FSM/__init__.py b/app/FSM/__init__.py new file mode 100644 index 0000000..67a7018 --- /dev/null +++ b/app/FSM/__init__.py @@ -0,0 +1,4 @@ +from .states import OrderForm, SearchForm, OrderingForm + + +__all__ = ["SearchForm", "OrderForm", "OrderingForm"] \ No newline at end of file diff --git a/app/FSM/states.py b/app/FSM/states.py new file mode 100644 index 0000000..54bc7aa --- /dev/null +++ b/app/FSM/states.py @@ -0,0 +1,24 @@ +from aiogram.fsm.state import State, StatesGroup + + +class SearchForm(StatesGroup): + search_option = State() + data_to_search = State() + search_result = State() + + +class OrderForm(StatesGroup): + id = State() + worker_id = State() + status_id = State() + counterparty = State() + customer = State() + commencement_work = State() + end_work = State() + description = State() + + +class OrderingForm(StatesGroup): + tools_list = State() + + diff --git a/app/handlers/orders.py b/app/handlers/orders.py index ed32ad6..754fd8c 100644 --- a/app/handlers/orders.py +++ b/app/handlers/orders.py @@ -33,24 +33,6 @@ find_order_params = {"search_by_name": "Поиск по названию", "sear "search_by_id": "Поиск по номеру заказа", "search_by_customer": "Поиск по заказчику"} -class SearchForm(StatesGroup): - search_option = State() - data_to_search = State() - search_result = State() - - -class OrderForm(StatesGroup): - id = State() - worker_id = State() - status_id = State() - counterparty = State() - customer = State() - commencement_work = State() - end_work = State() - - description = State() - - @orders_router.message(Command(commands="orders")) async def orders_menu(message: Message): order_main_upd = order_main_update if await IsAdmin()(message) else {}