File size: 1,401 Bytes
9c62b5f
 
 
6c377a5
9c62b5f
 
 
 
 
 
6c377a5
9c62b5f
 
 
6c377a5
 
 
 
 
 
9c62b5f
6c377a5
 
 
 
9c62b5f
 
 
6c377a5
1eb956a
9c62b5f
7a511fb
 
 
6c377a5
9c62b5f
 
6c377a5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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)