Files
Crm-Backend/repositories/module.py

19 lines
562 B
Python

from models import Board, Module
from repositories.mixins import *
class ModuleRepository(
BaseRepository,
RepGetAllMixin[Module],
):
entity_class = Module
def _process_get_all_stmt_with_args(self, stmt: Select, *args) -> Select:
project_id = args[0]
return stmt.where(Board.project_id == project_id).order_by(Board.lexorank)
async def get_by_ids(self, ids: list[int]) -> list[Module]:
stmt = select(Module).where(Module.id.in_(ids))
modules = await self.session.scalars(stmt)
return modules.all()