Merged
Conversation
The inventory service's implementation has been refactored to follow a layered architecture. This change introduces distinct API, service, and repository layers for improved modularity, maintainability, and scalability. The previous monolithic InventoryServer and InventoryStorage components have been replaced by dedicated modules for gRPC API handling, business logic, and data access, along with appropriate model and converter packages.
Introduces initial API definitions for the payment service under `payment/internal/api/payment/v1`. Refactors internal 'order' related components within the inventory service to 'inventory' to improve semantic consistency and align with the service's domain.
Moved payment processing logic from `cmd/main.go` to a dedicated `internal/service` layer. Introduced `internal/api` layer to handle gRPC requests and delegate to the service. Added `internal/model` for domain-specific data structures and `internal/converter` for mapping requests to internal models. This change improves separation of concerns, enhances maintainability, and provides a clear structure for future feature development.
Restructures the order service into distinct API, Service, Repository, and Client layers. This change improves modularity, testability, and maintainability by separating concerns: - API layer (`internal/api`): Handles HTTP request/response mapping. - Service layer (`internal/service`): Contains core business logic for order operations. - Repository layer (`internal/repository`): Manages data persistence (currently in-memory). - Client layer (`internal/client`): Abstracts external gRPC service calls (Inventory, Payment). This refactoring enhances the service's internal structure and prepares it for future feature development and scalability.
Integrated the `mockery` tool for automatic generation of Go interface mocks. Added `Taskfile` commands (`mockery:install`, `mockery:gen`) to manage and generate mocks, and `test-coverage`/`coverage:html` for code coverage. Implemented unit tests for the `payment` service and API layers, utilizing generated mocks for isolated testing. This enhances testability and code quality for the payment module.
The `OrderService` interface in the `inventory` module was renamed to `InventoryService` for improved domain alignment and clarity. Corresponding updates were made in `inventory/internal/api/inventory/v1/api.go` to use the new interface. Comprehensive unit tests were added for the `GetPart` and `ListParts` methods in both the `inventory` service and API layers, significantly increasing test coverage. Mockery configuration (`.mockery.yaml`) was updated to include the new service and repository paths, leading to the generation of new mocks for `InventoryService` and `OrderRepository`. The `payorder_test.go` in the `payment` service was refactored to remove mock-based assertions and instead verify the actual output of the `PayOrder` method, improving test quality.
Added extensive unit tests for the order microservice's API handlers and service layer logic. Refactored client interfaces (`PaymentClient`, `InventoryClient`) and the `order` service constructor to enhance testability through dependency injection. Updated `.mockery.yaml` configuration and generated new mocks for `OrderService`, `OrderRepository`, `PaymentClient`, and `InventoryClient`. Includes a minor fix in `order/internal/service/order/get.go` to correctly handle order not found scenarios.
Introduces a new GitHub Actions CI workflow to streamline linting. - A new script `.github/scripts/extract-versions.sh` is added to parse `Taskfile.yml` and extract essential tool versions (e.g., Go, golangci-lint) and module paths. These are then exported as GitHub Actions environment and output variables. - The main `.github/workflows/ci.yml` workflow orchestrates this version extraction. - A new reusable workflow, `.github/workflows/lint-reusable.yml`, is introduced to perform Go linting using the versions and module paths extracted in the previous step. This setup centralizes tool version management within `Taskfile.yml` and enhances the reusability of CI steps.
This configuration sets up golangci-lint with a comprehensive set of linters for Go projects. It ensures code quality, style consistency, and security best practices. Key aspects include: - Linters for error handling, static analysis, code style, security, and performance. - Specific exclusions for test files. - Custom rules for gosec, cyclop, depguard, revive, and forbidigo. - Integration of gofumpt and gci for code formatting.
Updated Go to 1.25 and golangci-lint to its latest version. Adjusted the golangci-lint command for proper module linting. Introduced local module replacement for 'pkg' in go.mod files across all services (inventory, order, payment). Performed widespread code formatting, import reordering, and ensured consistent trailing newlines. Enhanced gRPC client connection error handling in the order service. Simplified variable declarations in test files and standardized error message casing.
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.
No description provided.