from typing import Sequence from app.adapters.db.repositories import Repository from app.assets.models import Asset, GlobalParticipant from anydi import singleton import sqlalchemy as sa @singleton class AssetRepository(Repository[Asset]): def find_by_global_participant_id( self, *, global_participant_id: str ) -> Sequence[Asset]: """Retrieve multiple assets by their global_participant_id""" query = sa.select(Asset).where( Asset.global_participant_id == global_participant_id ) return self.db.session.execute(query).scalars().all() @singleton class GlobalParticipantRepository(Repository[GlobalParticipant]): pass