arm-core/api/src/repositories/vgo_assignments.py

25 lines
828 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""Ручные назначения строк ОСВ в версии консолидации."""
import uuid
from sqlalchemy import select
from sqlalchemy.ext.asyncio import AsyncSession
from src.models.enums import StatementType
from src.models.kfo import VgoAssignment
async def list_assignments(
session: AsyncSession, version_id: uuid.UUID, statement_type: StatementType
) -> list[VgoAssignment]:
"""Все ручные решения для версии и типа отчётности."""
stmt = (
select(VgoAssignment)
.where(
VgoAssignment.consolidation_version_id == version_id,
VgoAssignment.statement_type == statement_type,
)
.order_by(VgoAssignment.created_at, VgoAssignment.id)
)
return list((await session.scalars(stmt)).all())