new features

This commit is contained in:
Daniil
2026-02-27 23:33:56 +03:00
parent 937e58859a
commit dc04efe0fb
41 changed files with 2067 additions and 141 deletions
+2
View File
@@ -5,6 +5,7 @@ from cpv3.modules.projects.models import Project
from cpv3.modules.files.models import File
from cpv3.modules.transcription.models import Transcription
from cpv3.modules.users.models import User
from cpv3.modules.notifications.models import Notification
from cpv3.modules.webhooks.models import Webhook
__all__ = [
@@ -17,5 +18,6 @@ __all__ = [
"Transcription",
"Job",
"JobEvent",
"Notification",
"Webhook",
]
+29 -5
View File
@@ -2,19 +2,43 @@ from __future__ import annotations
from collections.abc import AsyncGenerator
from sqlalchemy.ext.asyncio import AsyncSession, async_sessionmaker, create_async_engine
from sqlalchemy.ext.asyncio import (
AsyncSession,
async_sessionmaker,
create_async_engine,
)
from cpv3.infrastructure.settings import get_settings
_settings = get_settings()
_database_url = _settings.get_database_url()
_engine_kwargs: dict[str, bool | int] = {
"echo": _settings.debug,
"pool_pre_ping": True,
}
if not _database_url.startswith("sqlite"):
_engine_kwargs.update(
{
"pool_size": _settings.db_pool_size,
"max_overflow": _settings.db_max_overflow,
"pool_timeout": _settings.db_pool_timeout,
"pool_recycle": _settings.db_pool_recycle_seconds,
}
)
_engine = create_async_engine(
_settings.get_database_url(),
echo=_settings.debug,
pool_pre_ping=True,
_database_url,
**_engine_kwargs,
)
SessionLocal = async_sessionmaker(bind=_engine, class_=AsyncSession, expire_on_commit=False)
SessionLocal = async_sessionmaker(
bind=_engine,
class_=AsyncSession,
expire_on_commit=False,
)
async def get_db() -> AsyncGenerator[AsyncSession, None]: