Bug fix and extends tracker's report endpoint#81
Merged
Conversation
prod-sync
prod-sync
…orts (name, description) fix: exclude future date transactions from report's calculation
…ker's report configuration
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR expands the tracker reports API to optionally include additional transaction fields via fields[transactions], and also introduces frontend/backend CORS + API client adjustments to improve cross-origin/API consumption reliability.
Changes:
- Backend: Add optional transaction fields (
name,description) to tracker report responses based onfields[transactions], plus supporting request validation. - Frontend: Introduce a shared Axios
apiClientand migrate a couple of calls to use it; add environment-specific Vite env files. - Docs: Update the trackers API collection and add a Cloudflare CORS configuration guide.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| Frontend/src/pages/access/Access.tsx | Switch login request to use the shared apiClient instead of raw Axios + ApiUrl. |
| Frontend/src/loader/appLoader.ts | Switch profile bootstrap calls to apiClient (centralized auth header handling). |
| Frontend/src/lib/api.ts | Add centralized Axios client with baseURL + request interceptor for Bearer token. |
| Frontend/.env.production | Add production Vite env values for API and storage endpoints. |
| Frontend/.env.dev | Add dev Vite env values (note: filename/mode loading needs adjustment). |
| Frontend/.env | Remove previous default env file. |
| Docs/collection/trackers_collection.yaml | Document fields[transactions]=name,description usage for tracker reports. |
| CLOUDFLARE_CORS_FIX.md | Add operational guide for Cloudflare CORS behavior/workarounds. |
| Backend/config/cors.php | Expose all headers and enable supports_credentials. |
| Backend/app/Http/Requests/API/V1/Tracker/ShowTrackerReportRequest.php | Add validation rules for fields.transactions. |
| Backend/app/Http/Controllers/API/V1/TrackerController.php | Dynamically select transaction columns for reports and include optional fields in the response. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+28
to
+29
| 'fields.transactions' => 'nullable', | ||
| 'fields.transactions.*' => 'nullable|string|in:name,description', |
Comment on lines
+1
to
+2
| VITE_API_URL=http://localhost:8080/api/v1 | ||
| VITE_STORAGE_API_URL=http://localhost:8080/api/v1/storage/ No newline at end of file |
| | CORS works in localhost but not production | Check APP_DEBUG and CORS_ALLOWED_ORIGINS in .env | | ||
| | Preflight OPTIONS requests fail | Ensure your backend allows OPTIONS method (it does in Laravel) | | ||
| | Custom headers stripped | Disable Auto Minify and Rocket Loader | | ||
| | Credentials not sent | Frontend must use `withCredentials: true` (already fixed in our apiClient) | |
Comment on lines
+13
to
+16
| const token = localStorage.getItem('Authorization'); | ||
| if (token) { | ||
| config.headers.Authorization = `Bearer ${token}`; | ||
| } |
Comment on lines
+9
to
+11
| 'exposed_headers' => ['*'], | ||
| 'max_age' => 3600, | ||
| 'supports_credentials' => false, | ||
| 'supports_credentials' => true, |
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.
This pull request introduces several improvements to the backend, improving API flexibility. The most important changes are grouped below:
Backend
name,description) in tracker reports via thefields.transactionsparameter, including validation and dynamic field selection in the response. [1] [2] [3]Documentation and Testing
fields[transactions]parameter for tracker reports.