feat: Implement company querying functionality with natural language processing and logging
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user