From 064bf6e3d8c527b92ab945055cacd3d6b6d443fa Mon Sep 17 00:00:00 2001 From: Wei Zang Date: Thu, 2 Apr 2026 15:20:49 +0100 Subject: [PATCH 1/2] Bump version to 2.0.5 and add env keys Increment package version to 2.0.5 and update .env.sample to include GEMINI_API_KEY and RESEND_API_KEY for new integrations. Also apply a minor README whitespace/formatting tweak. --- .env.sample | 2 ++ README.md | 2 ++ app/__init__.py | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.env.sample b/.env.sample index 6c9dea1..96c71b5 100644 --- a/.env.sample +++ b/.env.sample @@ -1,3 +1,5 @@ +GEMINI_API_KEY= +RESEND_API_KEY= BASE_URL= DB_HOST= DB_PORT=5432 diff --git a/README.md b/README.md index 53d4f90..ff8bffb 100644 --- a/README.md +++ b/README.md @@ -57,3 +57,5 @@ FastAPI automatically generates interactive documentation: ### Processing Large CSV Files 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: + + diff --git a/app/__init__.py b/app/__init__.py index 8854337..6c74be7 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -1,4 +1,4 @@ """NX AI - FastAPI, Python, Postgres, tsvector""" # Current Version -__version__ = "2.0.4" +__version__ = "2.0.5" From 0b8363ced380ea9cf6007da4b05ccc338199b693 Mon Sep 17 00:00:00 2001 From: Wei Zang Date: Thu, 2 Apr 2026 15:37:03 +0100 Subject: [PATCH 2/2] Add /resend endpoint and simplify meta Introduce a new /resend route (app/api/resend/resend.py) that returns a basic resend action and verifies RESEND_API_KEY from the environment. Export the router in app/api/resend/__init__.py and register it in app/api/routes.py; also add the resend entry to the root endpoints list in app/api/root.py. Simplify and reformat the metadata structure returned by make_meta (app/utils/make_meta.py) by removing redundant fields and normalizing keys (severity, message, base_url, version, time). --- app/api/resend/__init__.py | 3 +++ app/api/resend/resend.py | 26 ++++++++++++++++++++++++++ app/api/root.py | 1 + app/api/routes.py | 2 ++ app/utils/make_meta.py | 9 +++------ 5 files changed, 35 insertions(+), 6 deletions(-) create mode 100644 app/api/resend/__init__.py create mode 100644 app/api/resend/resend.py diff --git a/app/api/resend/__init__.py b/app/api/resend/__init__.py new file mode 100644 index 0000000..3a8535c --- /dev/null +++ b/app/api/resend/__init__.py @@ -0,0 +1,3 @@ +"""Resend Routes""" + +from .resend import router as prospects_resend \ No newline at end of file diff --git a/app/api/resend/resend.py b/app/api/resend/resend.py new file mode 100644 index 0000000..e81dc3e --- /dev/null +++ b/app/api/resend/resend.py @@ -0,0 +1,26 @@ + +from app import __version__ +import os +from app.utils.make_meta import make_meta + +from fastapi import APIRouter, Query, Path, Body, HTTPException + +from app.utils.db import get_db_connection + + +router = APIRouter() +base_url = os.getenv("BASE_URL", "http://localhost:8000") + +RESEND_API_KEY = os.getenv("RESEND_API_KEY") + +@router.get("/resend") +def root() -> dict: + """GET /resend endpoint.""" + if not RESEND_API_KEY: + meta = make_meta("error", "RESEND_API_KEY is missing from environment. Please set it in your .env file.") + return {"meta": meta} + meta = make_meta("success", "Resend endpoint") + data = [ + {"action,": f"send email"}, + ] + return {"meta": meta, "data": data} diff --git a/app/api/root.py b/app/api/root.py index b174463..380b924 100644 --- a/app/api/root.py +++ b/app/api/root.py @@ -21,6 +21,7 @@ def root() -> dict: } endpoints = [ {"name": "docs", "url": f"{base_url}/docs"}, + {"name": "resend", "url": f"{base_url}/resend"}, {"name": "health", "url": f"{base_url}/health"}, {"name": "prompts", "url": f"{base_url}/prompts"}, {"name": "prospects", "url": f"{base_url}/prospects"}, diff --git a/app/api/routes.py b/app/api/routes.py index a1e3473..afdd4f5 100644 --- a/app/api/routes.py +++ b/app/api/routes.py @@ -12,6 +12,7 @@ from app.api.root import router as root_router from app.api.health import router as health_router +from app.api.resend.resend import router as resend_router from app.api.prompts.prompts import router as prompts_router from app.api.prospects.prospects import router as prospects_router from app.api.prospects.search import router as prospects_search_router @@ -21,6 +22,7 @@ from app.api.prospects.database.process import router as prospects_process_router router.include_router(root_router) +router.include_router(resend_router) router.include_router(health_router) router.include_router(prompts_router) router.include_router(prospects_search_router) diff --git a/app/utils/make_meta.py b/app/utils/make_meta.py index 6731fc8..ac2684b 100644 --- a/app/utils/make_meta.py +++ b/app/utils/make_meta.py @@ -7,12 +7,9 @@ def make_meta(severity: str, title: str) -> dict: base_url = os.getenv("BASE_URL", "http://localhost:8000") epoch = int(time.time() * 1000) return { - "severity": severity, - "title": title, "version": __version__, - "endpoint": f"{base_url}/prospects", - "base": base_url, - "base_url": base_url, - "message": title, "time": epoch, + "severity": severity, + "message": title, + "base_url": base_url, }