ipns-poc-eval / src /services /_proposal_evaluation_service.py
Aryan Jain
update the apis according to the scores
7a511fb
from src.repositories import ProposalEvaluationRepository
from src.models import EvaluationType
class ProposalEvaluationService:
def __init__(self):
self.repo = ProposalEvaluationRepository
async def __aenter__(self):
return self
async def __aexit__(self, exc_type, exc_value, traceback):
pass
async def get_evaluations(
self,
proposal_id: str = None,
id: str = None,
evaluation_type: EvaluationType = None,
):
async with self.repo() as repo:
return await repo.get_evaluations(
proposal_id=proposal_id, id=id, evaluation_type=evaluation_type
)
async def create_evaluations(self, proposal_id: str, evaluations: dict):
async with self.repo() as repo:
return await repo.craete_evaluations(
proposal_id=proposal_id, proposal_evaluations=evaluations
)
async def update_evaluations(self, proposal_id: str, id: str, evaluations: dict):
async with self.repo() as repo:
return await repo.update_evaluations(
proposal_id=proposal_id, id=id, evaluations=evaluations
)
async def delete_evaluations(self, proposal_id: str = None, id: str = None):
async with self.repo() as repo:
return await repo.delete_evaluations(proposal_id=proposal_id, id=id)