add .gitignore, remove pycache

This commit is contained in:
Alexander Kalinovsky committed 2025-01-04 14:28:42 +01:00
1 parent 6dbe0536ca
commit 7793a0cb77
54 files changed
+10 -18

No files matched your search

+6
View File
@@ -0,0 +1,6 @@
__pycache__
/backend/.venv
.env
.pytest_cache
/backend/logs
.DS_Store
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
-15
View File
@@ -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
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1
View File
@@ -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],
+1 -1
View File
@@ -3,4 +3,4 @@ from .bot_enum import BotEnum, EnumMember
class LanguageBase(BotEnum):
DEFAULT = EnumMember("en", {"en": "🇬🇧 english"})
EN = EnumMember("en", {"en": "🇬🇧 english"})
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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])
Binary file not shown.