ipns-poc-eval / src /services /_evaluation_service.py
Aryan Jain
update the apis according to the scores
7a511fb
from src.repositories import EvaluationRepository
from src.models import EvaluationCriteriaType
class EvaluationService:
def __init__(self):
self._evaluation_repository = EvaluationRepository
async def __aenter__(self):
return self
async def __aexit__(self, exc_type, exc_value, traceback):
pass
async def get_criteria(
self,
id: str = None,
rfp_id: str = None,
evaluation_criteria_type: EvaluationCriteriaType = None,
):
async with self._evaluation_repository() as repository:
return await repository.get_criteria(
id=id, rfp_id=rfp_id, evaluation_criteria_type=evaluation_criteria_type
)
async def create_criteria(self, evaluation_criteria: dict):
async with self._evaluation_repository() as repository:
return await repository.create_criteria(evaluation_criteria)
async def update_criteria(self, id: str, evaluation_criteria: dict):
async with self._evaluation_repository() as repository:
return await repository.update_criteria(
id=id, evaluation_criteria=evaluation_criteria
)
async def delete_criteria(self, id: str = None, rfp_id: str = None):
async with self._evaluation_repository() as repository:
return await repository.delete_criteria(id=id, rfp_id=rfp_id)