Add CSV/JSON export for expenses and bills#590
Open
sofia-willow wants to merge 1 commit intorohitdash08:mainfrom
Open
Add CSV/JSON export for expenses and bills#590sofia-willow wants to merge 1 commit intorohitdash08:mainfrom
sofia-willow wants to merge 1 commit intorohitdash08:mainfrom
Conversation
New endpoints: - GET /expenses/export?format=csv|json — Export expenses with date/category filters - GET /bills/export?format=csv|json — Export active bills Features: - CSV format with proper Content-Disposition header for file download - JSON array format as alternative - Date range filtering (from/to query params) - Category filtering (category_id query param) - Category names resolved in export (not just IDs) - Auth-protected (JWT required) - No new dependencies (uses stdlib csv module) Tests (9 new, 31 total — all pass): - Expense CSV export with content validation - Expense JSON export - Date range filtering - Empty export (header only) - Invalid format returns 400 - Auth required (401) - Bill CSV export - Bill JSON export - Bill auth required Test infrastructure: - conftest.py updated with fakeredis mock (same fix as savings PR) Closes rohitdash08#589
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the CSV/JSON export feature mentioned in the README as a premium feature.
Closes #589
New Endpoints
GET/expenses/export?format=csvGET/expenses/export?format=jsonGET/bills/export?format=csvGET/bills/export?format=jsonQuery Parameters (expenses)
format:csvorjson(default:csv)from/to: Date range filter (ISO format)category_id: Filter by categoryCSV Format
Features
Content-Dispositionheader for browser file downloadcsvmodule — no new dependenciesTests (9 new, 31 total — all pass)
Notes
This is a contribution to help move the export feature forward. Happy to adjust the implementation based on feedback (e.g., adding Excel support, pagination for large exports, etc.).