19 lines
629 B
Python
19 lines
629 B
Python
from models import Board, BuiltInModule
|
|
from repositories.mixins import *
|
|
|
|
|
|
class BuiltInModuleRepository(
|
|
BaseRepository,
|
|
RepGetAllMixin[BuiltInModule],
|
|
):
|
|
entity_class = BuiltInModule
|
|
|
|
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[BuiltInModule]:
|
|
stmt = select(BuiltInModule).where(BuiltInModule.id.in_(ids))
|
|
built_in_modules = await self.session.scalars(stmt)
|
|
return built_in_modules.all()
|