Skip to content

Refactor queue routes, update LinkedIn and Apollo CSV imports#96

Merged
goldlabelapps merged 5 commits intomasterfrom
staging
Apr 22, 2026
Merged

Refactor queue routes, update LinkedIn and Apollo CSV imports#96
goldlabelapps merged 5 commits intomasterfrom
staging

Conversation

@goldlabelapps
Copy link
Copy Markdown
Owner

This pull request introduces several improvements and refactorings across the API endpoints, focusing primarily on enhancing prompt and queue management, streamlining code organization, and improving CSV import functionality. The most notable changes include refactoring prompt-related endpoints for clarity, updating queue CSV import logic for robustness and accuracy, and removing unused or redundant endpoints.

Prompt API improvements:

  • Refactored the GET /prompt endpoint to GET /prompts, which now returns prompt table metadata (record_count and columns) instead of paginated prompt records. The previous paginated listing logic was removed to simplify the endpoint. (app/api/prompt/prompt.py, README.md) [1] [2]
  • Renamed the endpoint and handler for emptying the prompt table from /prompt/drop to /prompt/empty, and updated all imports and references accordingly. (app/api/prompt/empty.py, app/api/prompt/__init__.py, app/api/routes.py) [1] [2] [3] [4]

Queue CSV import enhancements:

  • Improved the Apollo CSV import logic to perform actual batch inserts from a sample CSV file, with robust error handling and accurate import counts. The placeholder logic was replaced with real CSV parsing and database insertion. (app/api/queue/csv/apollo.py)
  • Enhanced the LinkedIn CSV import to support both "Job" and "Position" columns for backward compatibility, improved header detection, and aligned the database insertion order for consistency. (app/api/queue/csv/linkedin.py)

Queue API and code cleanup:

  • Removed the unused /queue/next endpoint and its router, consolidating queue record retrieval logic elsewhere. (app/api/queue/routes/next.py, app/api/queue/__init__.py) [1] [2] [3]
  • Updated the queue get endpoint to include a filters object in the response, clarifying which filters were applied and improving the structure of returned metadata. (app/api/queue/routes/get.py)
  • Adjusted related tests to reflect the new response structure for the queue get endpoint. (tests/test_queue.py)

Delete the standalone /queue/next route (remove app/api/queue/routes/next.py and unregister its router in app/api/queue/__init__.py). Also adjust the GET queue endpoint's meta message from "Queue table info" to "Next in queue" to better reflect the returned data.
Switch linkedin import to use the sample CSV and handle both 'Position' and 'Job' headers by normalizing 'Position' to 'Job'. Map row values to job (row.get('Job') or row.get('Position')) and update INSERTs to use the job column. Update the queue GET route meta/title and include an "in_queue" count in the response payload. Update tests to expect the new response keys and meta title.
Rename apollo seed.csv to sample.csv and implement actual CSV parsing + batched DB inserts for Apollo imports (batch_size=500). Map Apollo columns into queue fields, set collection/group, track imported_count, and update error messages to reference sample.csv. Adjust LinkedIn import row layout and SQL column order to include updated/hidden/created fields and place name/linkedin columns in the correct positions for executemany inserts.
Remove the 'in_queue' key from the read_queue response payload because it duplicated the 'total' value (total_count). This eliminates a redundant field and reduces confusion in the API response.
Rename prompt/drop to prompt/empty and update router imports and handler names for clarity. Files changed: app/api/prompt/drop.py -> app/api/prompt/empty.py (endpoint path /prompt/empty, handler empty_prompt_table, removed unused os import), app/api/prompt/__init__.py and app/api/routes.py (update imports and router include names). Also adjust queue GET response shape (app/api/queue/routes/get.py) to group collection/group values and collections/groups under a new "filters" object with keys collectionFilter and groupFilter. Clients should be updated to use the new endpoint and the revised queue response structure.
@goldlabelapps goldlabelapps merged commit e74a626 into master Apr 22, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant