diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8ef9d66 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +__pycache__ +/backend/.venv +.env +.pytest_cache +/backend/logs +.DS_Store \ No newline at end of file diff --git a/__pycache__/__init__.cpython-313.pyc b/__pycache__/__init__.cpython-313.pyc deleted file mode 100644 index f057016..0000000 Binary files a/__pycache__/__init__.cpython-313.pyc and /dev/null differ diff --git a/__pycache__/db_storage.cpython-313.pyc b/__pycache__/db_storage.cpython-313.pyc deleted file mode 100644 index 6c46afe..0000000 Binary files a/__pycache__/db_storage.cpython-313.pyc and /dev/null differ diff --git a/__pycache__/lifespan.cpython-313.pyc b/__pycache__/lifespan.cpython-313.pyc deleted file mode 100644 index f9bc4e4..0000000 Binary files a/__pycache__/lifespan.cpython-313.pyc and /dev/null differ diff --git a/__pycache__/main.cpython-313.pyc b/__pycache__/main.cpython-313.pyc deleted file mode 100644 index 9d6e6c5..0000000 Binary files a/__pycache__/main.cpython-313.pyc and /dev/null differ diff --git a/api_route/__pycache__/telegram.cpython-313.pyc b/api_route/__pycache__/telegram.cpython-313.pyc deleted file mode 100644 index 91c03c6..0000000 Binary files a/api_route/__pycache__/telegram.cpython-313.pyc and /dev/null differ diff --git a/bot/__pycache__/command_context_filter.cpython-313.pyc b/bot/__pycache__/command_context_filter.cpython-313.pyc deleted file mode 100644 index ebf0bbb..0000000 Binary files a/bot/__pycache__/command_context_filter.cpython-313.pyc and /dev/null differ diff --git a/bot/handlers/__pycache__/__init__.cpython-313.pyc b/bot/handlers/__pycache__/__init__.cpython-313.pyc deleted file mode 100644 index 42a9793..0000000 Binary files a/bot/handlers/__pycache__/__init__.cpython-313.pyc and /dev/null differ diff --git a/bot/handlers/__pycache__/callback_data.cpython-313.pyc b/bot/handlers/__pycache__/callback_data.cpython-313.pyc deleted file mode 100644 index 7368870..0000000 Binary files a/bot/handlers/__pycache__/callback_data.cpython-313.pyc and /dev/null differ diff --git a/bot/handlers/__pycache__/context.cpython-313.pyc b/bot/handlers/__pycache__/context.cpython-313.pyc deleted file mode 100644 index a7291a0..0000000 Binary files a/bot/handlers/__pycache__/context.cpython-313.pyc and /dev/null differ diff --git a/bot/handlers/__pycache__/navigation.cpython-313.pyc b/bot/handlers/__pycache__/navigation.cpython-313.pyc deleted file mode 100644 index eb85d66..0000000 Binary files a/bot/handlers/__pycache__/navigation.cpython-313.pyc and /dev/null differ diff --git a/bot/handlers/__pycache__/start.cpython-313.pyc b/bot/handlers/__pycache__/start.cpython-313.pyc deleted file mode 100644 index b86ac41..0000000 Binary files a/bot/handlers/__pycache__/start.cpython-313.pyc and /dev/null differ diff --git a/bot/handlers/common/__pycache__/__init__.cpython-313.pyc b/bot/handlers/common/__pycache__/__init__.cpython-313.pyc deleted file mode 100644 index d945475..0000000 Binary files a/bot/handlers/common/__pycache__/__init__.cpython-313.pyc and /dev/null differ diff --git a/bot/handlers/editors/__pycache__/__init__.cpython-313.pyc b/bot/handlers/editors/__pycache__/__init__.cpython-313.pyc deleted file mode 100644 index 540efdb..0000000 Binary files a/bot/handlers/editors/__pycache__/__init__.cpython-313.pyc and /dev/null differ diff --git a/bot/handlers/editors/__pycache__/bool.cpython-313.pyc b/bot/handlers/editors/__pycache__/bool.cpython-313.pyc deleted file mode 100644 index eed9da3..0000000 Binary files a/bot/handlers/editors/__pycache__/bool.cpython-313.pyc and /dev/null differ diff --git a/bot/handlers/editors/__pycache__/boolean.cpython-313.pyc b/bot/handlers/editors/__pycache__/boolean.cpython-313.pyc deleted file mode 100644 index 6e85673..0000000 Binary files a/bot/handlers/editors/__pycache__/boolean.cpython-313.pyc and /dev/null differ diff --git a/bot/handlers/editors/__pycache__/common.cpython-313.pyc b/bot/handlers/editors/__pycache__/common.cpython-313.pyc deleted file mode 100644 index be50ead..0000000 Binary files a/bot/handlers/editors/__pycache__/common.cpython-313.pyc and /dev/null differ diff --git a/bot/handlers/editors/__pycache__/date.cpython-313.pyc b/bot/handlers/editors/__pycache__/date.cpython-313.pyc deleted file mode 100644 index 92491ad..0000000 Binary files a/bot/handlers/editors/__pycache__/date.cpython-313.pyc and /dev/null differ diff --git a/bot/handlers/editors/__pycache__/entity.cpython-313.pyc b/bot/handlers/editors/__pycache__/entity.cpython-313.pyc deleted file mode 100644 index bd0519b..0000000 Binary files a/bot/handlers/editors/__pycache__/entity.cpython-313.pyc and /dev/null differ diff --git a/bot/handlers/editors/__pycache__/list_entity.cpython-313.pyc b/bot/handlers/editors/__pycache__/list_entity.cpython-313.pyc deleted file mode 100644 index e726013..0000000 Binary files a/bot/handlers/editors/__pycache__/list_entity.cpython-313.pyc and /dev/null differ diff --git a/bot/handlers/editors/__pycache__/string.cpython-313.pyc b/bot/handlers/editors/__pycache__/string.cpython-313.pyc deleted file mode 100644 index 6c48817..0000000 Binary files a/bot/handlers/editors/__pycache__/string.cpython-313.pyc and /dev/null differ diff --git a/bot/handlers/forms/__pycache__/entity_form.cpython-313.pyc b/bot/handlers/forms/__pycache__/entity_form.cpython-313.pyc deleted file mode 100644 index cc470da..0000000 Binary files a/bot/handlers/forms/__pycache__/entity_form.cpython-313.pyc and /dev/null differ diff --git a/bot/handlers/forms/__pycache__/entity_list.cpython-313.pyc b/bot/handlers/forms/__pycache__/entity_list.cpython-313.pyc deleted file mode 100644 index 6f4bf5b..0000000 Binary files a/bot/handlers/forms/__pycache__/entity_list.cpython-313.pyc and /dev/null differ diff --git a/bot/handlers/menu/__pycache__/entities.cpython-313.pyc b/bot/handlers/menu/__pycache__/entities.cpython-313.pyc deleted file mode 100644 index c5c54cb..0000000 Binary files a/bot/handlers/menu/__pycache__/entities.cpython-313.pyc and /dev/null differ diff --git a/bot/handlers/menu/__pycache__/language.cpython-313.pyc b/bot/handlers/menu/__pycache__/language.cpython-313.pyc deleted file mode 100644 index 72358b0..0000000 Binary files a/bot/handlers/menu/__pycache__/language.cpython-313.pyc and /dev/null differ diff --git a/bot/handlers/menu/__pycache__/main.cpython-313.pyc b/bot/handlers/menu/__pycache__/main.cpython-313.pyc deleted file mode 100644 index 7f645c0..0000000 Binary files a/bot/handlers/menu/__pycache__/main.cpython-313.pyc and /dev/null differ diff --git a/bot/handlers/menu/__pycache__/parameters.cpython-313.pyc b/bot/handlers/menu/__pycache__/parameters.cpython-313.pyc deleted file mode 100644 index b9636ff..0000000 Binary files a/bot/handlers/menu/__pycache__/parameters.cpython-313.pyc and /dev/null differ diff --git a/bot/handlers/menu/__pycache__/settings.cpython-313.pyc b/bot/handlers/menu/__pycache__/settings.cpython-313.pyc deleted file mode 100644 index 0c5e2e5..0000000 Binary files a/bot/handlers/menu/__pycache__/settings.cpython-313.pyc and /dev/null differ diff --git a/config/__pycache__/__init__.cpython-313.pyc b/config/__pycache__/__init__.cpython-313.pyc deleted file mode 100644 index 1305267..0000000 Binary files a/config/__pycache__/__init__.cpython-313.pyc and /dev/null differ diff --git a/db/__init__.py b/db/__init__.py index 5a776d5..aae659a 100644 --- a/db/__init__.py +++ b/db/__init__.py @@ -1,4 +1,3 @@ -from sqlmodel import select from sqlmodel.ext.asyncio.session import AsyncSession from sqlalchemy.ext.asyncio import create_async_engine from sqlalchemy.orm import sessionmaker @@ -14,20 +13,6 @@ async_session = sessionmaker[AsyncSession]( async_engine, class_=AsyncSession, expire_on_commit=False ) -async def init_db(session: AsyncSession) -> None: - - from app.models import User, Language,Role - - user = (await session.exec( - select(User).where(User.id == config.ADMIN_TELEGRAM_ID) - )).first() - if not user: - await User.create(session, User( - id = config.ADMIN_TELEGRAM_ID, - lang = Language.DEFAULT, - roles = [Role.SUPER_USER], - name = "Admin"), commit = True) - async def get_db() -> AsyncSession: # type: ignore async with async_session() as session: yield session \ No newline at end of file diff --git a/db/__pycache__/__init__.cpython-313.pyc b/db/__pycache__/__init__.cpython-313.pyc deleted file mode 100644 index 6fed023..0000000 Binary files a/db/__pycache__/__init__.cpython-313.pyc and /dev/null differ diff --git a/fsm/__pycache__/db_storage.cpython-313.pyc b/fsm/__pycache__/db_storage.cpython-313.pyc deleted file mode 100644 index 665136f..0000000 Binary files a/fsm/__pycache__/db_storage.cpython-313.pyc and /dev/null differ diff --git a/middleware/telegram/__pycache__/__init__.cpython-313.pyc b/middleware/telegram/__pycache__/__init__.cpython-313.pyc deleted file mode 100644 index deb079b..0000000 Binary files a/middleware/telegram/__pycache__/__init__.cpython-313.pyc and /dev/null differ diff --git a/middleware/telegram/__pycache__/auth.cpython-313.pyc b/middleware/telegram/__pycache__/auth.cpython-313.pyc deleted file mode 100644 index ce95c2a..0000000 Binary files a/middleware/telegram/__pycache__/auth.cpython-313.pyc and /dev/null differ diff --git a/middleware/telegram/__pycache__/i18n.cpython-313.pyc b/middleware/telegram/__pycache__/i18n.cpython-313.pyc deleted file mode 100644 index d98e277..0000000 Binary files a/middleware/telegram/__pycache__/i18n.cpython-313.pyc and /dev/null differ diff --git a/middleware/telegram/__pycache__/reset_state.cpython-313.pyc b/middleware/telegram/__pycache__/reset_state.cpython-313.pyc deleted file mode 100644 index ed26303..0000000 Binary files a/middleware/telegram/__pycache__/reset_state.cpython-313.pyc and /dev/null differ diff --git a/model/__pycache__/__init__.cpython-313.pyc b/model/__pycache__/__init__.cpython-313.pyc deleted file mode 100644 index 4952e7d..0000000 Binary files a/model/__pycache__/__init__.cpython-313.pyc and /dev/null differ diff --git a/model/__pycache__/_singleton.cpython-313.pyc b/model/__pycache__/_singleton.cpython-313.pyc deleted file mode 100644 index a1a071d..0000000 Binary files a/model/__pycache__/_singleton.cpython-313.pyc and /dev/null differ diff --git a/model/__pycache__/bot_entity.cpython-313.pyc b/model/__pycache__/bot_entity.cpython-313.pyc deleted file mode 100644 index cfd40ba..0000000 Binary files a/model/__pycache__/bot_entity.cpython-313.pyc and /dev/null differ diff --git a/model/__pycache__/bot_enum.cpython-313.pyc b/model/__pycache__/bot_enum.cpython-313.pyc deleted file mode 100644 index 3b1319c..0000000 Binary files a/model/__pycache__/bot_enum.cpython-313.pyc and /dev/null differ diff --git a/model/__pycache__/descriptors.cpython-313.pyc b/model/__pycache__/descriptors.cpython-313.pyc deleted file mode 100644 index 0b96cd2..0000000 Binary files a/model/__pycache__/descriptors.cpython-313.pyc and /dev/null differ diff --git a/model/__pycache__/entity_field.cpython-313.pyc b/model/__pycache__/entity_field.cpython-313.pyc deleted file mode 100644 index 5ba201a..0000000 Binary files a/model/__pycache__/entity_field.cpython-313.pyc and /dev/null differ diff --git a/model/__pycache__/entity_metadata.cpython-313.pyc b/model/__pycache__/entity_metadata.cpython-313.pyc deleted file mode 100644 index ca16512..0000000 Binary files a/model/__pycache__/entity_metadata.cpython-313.pyc and /dev/null differ diff --git a/model/__pycache__/fsm_storage.cpython-313.pyc b/model/__pycache__/fsm_storage.cpython-313.pyc deleted file mode 100644 index c89ffbf..0000000 Binary files a/model/__pycache__/fsm_storage.cpython-313.pyc and /dev/null differ diff --git a/model/__pycache__/language.cpython-313.pyc b/model/__pycache__/language.cpython-313.pyc deleted file mode 100644 index 69fa7dc..0000000 Binary files a/model/__pycache__/language.cpython-313.pyc and /dev/null differ diff --git a/model/__pycache__/owned_bot_entity.cpython-313.pyc b/model/__pycache__/owned_bot_entity.cpython-313.pyc deleted file mode 100644 index 68ddc00..0000000 Binary files a/model/__pycache__/owned_bot_entity.cpython-313.pyc and /dev/null differ diff --git a/model/__pycache__/role.cpython-313.pyc b/model/__pycache__/role.cpython-313.pyc deleted file mode 100644 index 3ada48d..0000000 Binary files a/model/__pycache__/role.cpython-313.pyc and /dev/null differ diff --git a/model/__pycache__/settings.cpython-313.pyc b/model/__pycache__/settings.cpython-313.pyc deleted file mode 100644 index f7e923a..0000000 Binary files a/model/__pycache__/settings.cpython-313.pyc and /dev/null differ diff --git a/model/__pycache__/user.cpython-313.pyc b/model/__pycache__/user.cpython-313.pyc deleted file mode 100644 index 4235e32..0000000 Binary files a/model/__pycache__/user.cpython-313.pyc and /dev/null differ diff --git a/model/descriptors.py b/model/descriptors.py index 8268ca3..be7cb77 100644 --- a/model/descriptors.py +++ b/model/descriptors.py @@ -61,6 +61,7 @@ class _BaseEntityDescriptor: item_caption_btn: EntityItemCaptionCallable | None = None show_in_entities_menu: bool = True field_sequence: list[str] = None + edit_buttons: list[list[str]] = None permissions: dict[EntityPermission, list[RoleBase]] = field(default_factory = lambda: { EntityPermission.LIST: [RoleBase.DEFAULT_USER, RoleBase.SUPER_USER], EntityPermission.READ: [RoleBase.DEFAULT_USER, RoleBase.SUPER_USER], diff --git a/model/language.py b/model/language.py index 7a8f605..097364e 100644 --- a/model/language.py +++ b/model/language.py @@ -3,4 +3,4 @@ from .bot_enum import BotEnum, EnumMember class LanguageBase(BotEnum): - DEFAULT = EnumMember("en", {"en": "🇬🇧 english"}) \ No newline at end of file + EN = EnumMember("en", {"en": "🇬🇧 english"}) \ No newline at end of file diff --git a/model/settings.py b/model/settings.py index b2abdfa..6f42477 100644 --- a/model/settings.py +++ b/model/settings.py @@ -23,7 +23,7 @@ class SettingsMetaclass(type): if base_classes: settings_descriptors = base_classes[0].__dict__.get("_settings_descriptors", {}) - for annotation in attributes['__annotations__']: + for annotation in attributes.get('__annotations__', {}): if annotation in ["_settings_descriptors", "_cache", "_cached_settings"]: continue diff --git a/model/user.py b/model/user.py index 9984b77..03edf03 100644 --- a/model/user.py +++ b/model/user.py @@ -13,7 +13,7 @@ class UserBase(BotEntity, table = False): __tablename__ = "user" - lang: LanguageBase = Field(sa_type = EnumType(LanguageBase), default = LanguageBase.DEFAULT) + lang: LanguageBase = Field(sa_type = EnumType(LanguageBase), default = LanguageBase.EN) is_active: bool = True roles: list[RoleBase] = Field(sa_type=ARRAY(EnumType(RoleBase)), default = [RoleBase.DEFAULT_USER]) \ No newline at end of file diff --git a/utils/__pycache__/__init__.cpython-313.pyc b/utils/__pycache__/__init__.cpython-313.pyc deleted file mode 100644 index 278f823..0000000 Binary files a/utils/__pycache__/__init__.cpython-313.pyc and /dev/null differ