Spaces:
Runtime error
Runtime error
File size: 1,541 Bytes
6c377a5 8e1c132 6c377a5 8e1c132 6c377a5 8e1c132 6c377a5 8e1c132 1f780d7 8e1c132 7a511fb 8e1c132 6c377a5 8e1c132 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 40 41 42 | from src.models import Proposal, ProposalStatus
from src.repositories import ProposalRepository
class ProposalService:
def __init__(self):
self.proposal_repository = ProposalRepository
async def __aenter__(self):
return self
async def __aexit__(self, exc_type, exc_value, traceback):
pass
async def get_proposals(
self, proposal_id: str = None, rfp_id: str = None, status: ProposalStatus = None
):
async with self.proposal_repository() as repository:
return await repository.get_proposals(
proposal_id=proposal_id, rfp_id=rfp_id, status=status
)
async def get_proposals_by_rfp_id(self, rfp_id: str):
async with self.proposal_repository() as repository:
return await repository.get_proposals_by_rfp_id(rfp_id)
async def create_proposal(self, proposal: dict):
async with self.proposal_repository() as repository:
return await repository.create_proposal(proposal)
async def update_proposal(self, proposal_id: str, proposal: dict):
async with self.proposal_repository() as repository:
return await repository.update_proposal(
proposal_id=proposal_id, proposal=proposal
)
async def delete_proposal(self, proposal_id: str = None, rfp_id: str = None):
async with self.proposal_repository() as repository:
return await repository.delete_proposal(
proposal_id=proposal_id, rfp_id=rfp_id
)
|