ipns-sow / src /services /_rfp_service.py
Aryan Jain
add apis for rfp
3e28a11
from uuid import UUID
from src.models import RFP, RFPStatus
from src.repositories import RFPRepository
class RFPService:
def __init__(self):
self.rfp_repository = RFPRepository
async def __aenter__(self):
return self
async def __aexit__(self, exc_type, exc_value, traceback):
pass
async def get_rfps(self, rfp_id: UUID = None, status: RFPStatus = None):
async with self.rfp_repository() as repository:
return await repository.get_rfps(rfp_id=rfp_id, status=status)
async def create_rfp(self, rfp: dict):
async with self.rfp_repository() as repository:
return await repository.create_rfp(rfp)
async def update_rfp(self, rfp_id: UUID, rfp: dict):
async with self.rfp_repository() as repository:
return await repository.update_rfp(rfp_id=rfp_id, rfp=rfp)
async def delete_rfp(self, rfp_id: UUID):
async with self.rfp_repository() as repository:
return await repository.delete_rfp(rfp_id)