from fansifter_common.auth.types import JointVentureParticipant from pydantic import TypeAdapter from dmp.adapters.db import ReportingRepository from dmp.fandata.models import AccountArtistFullFanDataAccessDbt ArtistJointVentureList = TypeAdapter(list[JointVentureParticipant]) class ArtistJointVentureRepository( ReportingRepository[AccountArtistFullFanDataAccessDbt] ): def find_by_global_participant_id( self, global_participant_id: str, ) -> list[JointVentureParticipant]: template_name = "artist_joint_venture/find-by-global-participant-id.sql" query = self.db.query_from_template( template_name, context={ "global_participant_id": global_participant_id, }, ) result = self.db.session.execute(query) return ArtistJointVentureList.validate_python( result.mappings(), )