Skip to content

Commit 27361fc

Browse files
Merge pull request #44 from goldlabelapps/staging
This pull request introduces a new `/resend` API endpoint and related infrastructure for sending emails, as well as some minor improvements and housekeeping updates. The most significant changes include adding the Resend API integration, updating the API routing, and enhancing environment variable management.
2 parents 43be8f6 + 0b8363c commit 27361fc

8 files changed

Lines changed: 40 additions & 7 deletions

File tree

.env.sample

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
GEMINI_API_KEY=
2+
RESEND_API_KEY=
13
BASE_URL=
24
DB_HOST=
35
DB_PORT=5432

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,5 @@ FastAPI automatically generates interactive documentation:
5757
### Processing Large CSV Files
5858

5959
The `/prospects/process` endpoint is designed for robust, scalable ingestion of large CSV files (e.g., 1300+ rows, 300KB+). It follows the same normalization and insertion pattern as `/prospects/seed`, but is optimized for large files:
60+
61+

app/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
"""NX AI - FastAPI, Python, Postgres, tsvector"""
22

33
# Current Version
4-
__version__ = "2.0.4"
4+
__version__ = "2.0.5"

app/api/resend/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
"""Resend Routes"""
2+
3+
from .resend import router as prospects_resend

app/api/resend/resend.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
2+
from app import __version__
3+
import os
4+
from app.utils.make_meta import make_meta
5+
6+
from fastapi import APIRouter, Query, Path, Body, HTTPException
7+
8+
from app.utils.db import get_db_connection
9+
10+
11+
router = APIRouter()
12+
base_url = os.getenv("BASE_URL", "http://localhost:8000")
13+
14+
RESEND_API_KEY = os.getenv("RESEND_API_KEY")
15+
16+
@router.get("/resend")
17+
def root() -> dict:
18+
"""GET /resend endpoint."""
19+
if not RESEND_API_KEY:
20+
meta = make_meta("error", "RESEND_API_KEY is missing from environment. Please set it in your .env file.")
21+
return {"meta": meta}
22+
meta = make_meta("success", "Resend endpoint")
23+
data = [
24+
{"action,": f"send email"},
25+
]
26+
return {"meta": meta, "data": data}

app/api/root.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ def root() -> dict:
2121
}
2222
endpoints = [
2323
{"name": "docs", "url": f"{base_url}/docs"},
24+
{"name": "resend", "url": f"{base_url}/resend"},
2425
{"name": "health", "url": f"{base_url}/health"},
2526
{"name": "prompts", "url": f"{base_url}/prompts"},
2627
{"name": "prospects", "url": f"{base_url}/prospects"},

app/api/routes.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
from app.api.root import router as root_router
1414
from app.api.health import router as health_router
15+
from app.api.resend.resend import router as resend_router
1516
from app.api.prompts.prompts import router as prompts_router
1617
from app.api.prospects.prospects import router as prospects_router
1718
from app.api.prospects.search import router as prospects_search_router
@@ -21,6 +22,7 @@
2122
from app.api.prospects.database.process import router as prospects_process_router
2223

2324
router.include_router(root_router)
25+
router.include_router(resend_router)
2426
router.include_router(health_router)
2527
router.include_router(prompts_router)
2628
router.include_router(prospects_search_router)

app/utils/make_meta.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,9 @@ def make_meta(severity: str, title: str) -> dict:
77
base_url = os.getenv("BASE_URL", "http://localhost:8000")
88
epoch = int(time.time() * 1000)
99
return {
10-
"severity": severity,
11-
"title": title,
1210
"version": __version__,
13-
"endpoint": f"{base_url}/prospects",
14-
"base": base_url,
15-
"base_url": base_url,
16-
"message": title,
1711
"time": epoch,
12+
"severity": severity,
13+
"message": title,
14+
"base_url": base_url,
1815
}

0 commit comments

Comments
 (0)