from src.repositories import ComparativeWeightRepository class ComparativeWeightService: def __init__(self): self.comparative_weight_repository = ComparativeWeightRepository async def __aenter__(self): return self async def __aexit__(self, exc_type, exc_value, traceback): pass async def get_comparative_weights(self, rfp_id: str = None, id: str = None): async with self.comparative_weight_repository() as comparative_weight_repository: return await comparative_weight_repository.get_comparative_weights( rfp_id=rfp_id, id=id ) async def create_comparative_weights(self, rfp_id: str, comparative_weights: dict): async with self.comparative_weight_repository() as comparative_weight_repository: return await comparative_weight_repository.create_comparative_weights( rfp_id=rfp_id, comparative_weights=comparative_weights ) async def update_comparative_weights( self, id: str = None, rfp_id: str = None, comparative_weights: dict = None ): async with self.comparative_weight_repository() as comparative_weight_repository: return await comparative_weight_repository.update_comparative_weights( id=id, rfp_id=rfp_id, comparative_weights=comparative_weights ) async def delete_comparative_weights(self, id: str = None, rfp_id: str = None): async with self.comparative_weight_repository() as comparative_weight_repository: return await comparative_weight_repository.delete_comparative_weights( id=id, rfp_id=rfp_id )