Refactor code structure for improved readability and maintainability

This commit is contained in:
bolade
2025-10-08 10:03:30 +01:00
parent 84e3c7b72a
commit 26a1197db0
7 changed files with 25 additions and 12 deletions
Binary file not shown.
+11 -7
View File
@@ -18,22 +18,24 @@ router = APIRouter(tags=["Investor Routes"])
class InvestorCreate(BaseModel):
name: str
description: Optional[str] = None
website: Optional[str] = None
headquarters: Optional[str] = None
aum: int
check_size_lower: int
check_size_upper: int
geographic_focus: str
stage_focus: InvestmentStage
number_of_investments: int = 0
class InvestorUpdate(BaseModel):
name: Optional[str] = None
description: Optional[str] = None
website: Optional[str] = None
headquarters: Optional[str] = None
aum: Optional[int] = None
check_size_lower: Optional[int] = None
check_size_upper: Optional[int] = None
geographic_focus: Optional[str] = None
stage_focus: Optional[InvestmentStage] = None
number_of_investments: Optional[int] = None
@@ -155,8 +157,9 @@ def filter_investors(
)
# Apply filters
if stage:
query = query.filter(InvestorTable.stage_focus == stage)
# Note: stage filtering is now done at fund level via fund.investment_stages
# if stage:
# query = query.filter(InvestorTable.stage_focus == stage)
if min_check_size is not None:
query = query.filter(InvestorTable.check_size_lower >= min_check_size)
@@ -413,9 +416,10 @@ def find_similar_investors(
for candidate in candidates:
score = 0
# Stage focus match (30 points)
if candidate.stage_focus == target_investor.stage_focus:
score += 30
# Stage focus match is now handled at fund level
# Skip stage matching at investor level since stage_focus no longer exists
# if candidate.stage_focus == target_investor.stage_focus:
# score += 30
# Geographic focus match (20 points for exact, 10 for partial)
if candidate.geographic_focus and target_investor.geographic_focus: