Add report service and related routes for financial reporting#15
Add report service and related routes for financial reporting#15
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds a report service to support financial reporting functionalities and integrates two new API endpoints: one for retrieving a detailed or summary financial report at /reports/finance and one for obtaining an AI-generated report summary at /reports/analysis.
- Added new swagger documentation for the two endpoints.
- Introduced a report service stub with corresponding interface and tests.
- Updated dependency wiring, route configuration, and error constants to support the new functionality.
Reviewed Changes
Copilot reviewed 14 out of 16 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| swagger/docs.go | Added swagger definitions for /reports/finance and /reports/analysis endpoints. |
| internal/module/report/usecase/service.go | Implemented stub for report service methods. |
| internal/interfaces/http/report_test.go | Added tests for both report endpoints, including error and success cases. |
| internal/interfaces/http/report.go | Added handler functions for GetReport and GetReportSummary. |
| internal/interfaces/http/handler_test.go | Updated handler wiring with the new report service. |
| Remaining files | Updated DI wiring (wire_gen.go, wire.go, providers.go) and mocks for integration. |
Files not reviewed (2)
- swagger/swagger.json: Language not supported
- swagger/swagger.yaml: Language not supported
Comments suppressed due to low confidence (1)
internal/interfaces/http/dto/report.go:7
- [nitpick] Consider renaming the field 'Categorys' to 'Categories' to align with conventional spelling.
"Categorys []string `json:\"categorys\" example:\"[\\\"Food\\\", \\\"Transport\\\"]\" binding:\"required\"`"
|
Suggest using a timestamp (e.g. Unix time) for the time parameter to avoid potential issues with time zones. |
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a new reportService along with endpoints for financial reporting and report summary generation. Key changes include:
- Added Swagger documentation for /reports/finance and /reports/analysis endpoints.
- Implemented report service usecase and related HTTP handlers, tests, and mocks.
- Updated dependency injection and provider wiring to include the new report service.
Reviewed Changes
Copilot reviewed 14 out of 16 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| swagger/docs.go | Added Swagger docs for two new report endpoints |
| internal/module/report/usecase/service.go | Introduced report service usecase with placeholder methods |
| internal/interfaces/http/report_test.go | Added tests for report endpoints |
| internal/interfaces/http/report_mock.go | Generated mocks for the report service |
| internal/interfaces/http/report.go | Implemented HTTP handlers for report and report summary |
| internal/interfaces/http/handler_test.go | Updated handler tests to incorporate report service |
| internal/interfaces/http/handler.go | Integrated report service into the HTTP handler |
| internal/interfaces/http/error/error.go | Added new error constants for report-related failures |
| internal/interfaces/http/dto/report.go | Defined DTO types for report responses |
| internal/entities/report.go | Added entity definitions for report data |
| cmd/server/wire_gen.go, cmd/server/wire.go, | Updated wiring to inject the report service |
| cmd/server/route.go | Added new routes for report endpoints |
| cmd/server/providers.go | Provided configuration for initializing the report service |
Files not reviewed (2)
- swagger/swagger.json: Language not supported
- swagger/swagger.yaml: Language not supported
…Swagger documentation
Description
This pull request introduces the
reportServiceto handle report-related business logic and implements the following APIs:GET /reports/finance: Retrieves the financial report for a given duration based on the query parameters:
type: The type of report (e.g., saving, expense, or net income).start: The start date inYYYY-MM-DDformat.end: The end date inYYYY-MM-DDformat.GET /reports/analysis: Generates a financial summary using AI for the user.
Tests