feat: Implement company querying functionality with natural language processing and logging

This commit is contained in:
bolade
2025-10-27 20:12:30 +01:00
parent 1ac755b2d7
commit ff0010019e
7 changed files with 225 additions and 70 deletions
+9 -1
View File
@@ -1,15 +1,21 @@
import os
from typing import List
from db.db import get_db
from db.models import InvestorTable
from fastapi import APIRouter, Depends, HTTPException
from pydantic import BaseModel
from services.crm import folk
from services.crm import FolkAPI
from sqlalchemy.orm import Session, selectinload
router = APIRouter(prefix="/folk", tags=["Folk CRM"])
def get_folk_client():
"""Get Folk API client with loaded environment variables"""
return FolkAPI(api_key=os.environ.get("FOLK_API_KEY", ""))
class GroupResponse(BaseModel):
id: str
name: str
@@ -44,6 +50,7 @@ def get_folk_groups():
to sync investors to Folk.
"""
try:
folk = get_folk_client()
groups_data = folk.get_groups()
items = groups_data.get("data", {}).get("items", [])
@@ -71,6 +78,7 @@ def sync_investors_to_folk(
Returns:
Summary of sync operation including successes and errors
"""
folk = get_folk_client()
# Fetch investors with their team members
investors = (
db.query(InvestorTable)