-
Notifications
You must be signed in to change notification settings - Fork 0
Grpc2 #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Grpc2 #4
Conversation
Replaced `UserResource` with gRPC-based DTOs and responses for user-related operations. Introduced gRPC DTOs like `AuthenticateGrpcDTO`, `BaseGrpcDTO`, and others for better structure and maintainability. Enhanced user operations with protocol buffer-generated request and response classes for authentication, user management, and password handling.
Eliminated gRPC and protobuf dependencies, configurations, and related scripts from the Dockerfile. Streamlined PHP extension installation, reduced complexity by removing supervisor and non-essential build steps, and optimized Laravel startup for Swoole.
Reintroduced gRPC and protobuf dependencies in Dockerfile with corresponding installations and configurations. Enhanced the build process
…ervice integration Added `GrpcTransformer` to simplify and standardize transformation of gRPC DTOs to arrays. Updated `UserGrpcService` to utilize `GrpcTransformer` methods for better maintainability. Included metadata handling for gRPC requests with authorization bearer token support. Upgraded dependencies in `composer.lock` for compatibility.
…enhanced gRPC implementation Eliminated Redis-related configurations and extensions across the app, including `.env`, `php.ini`, and Laravel config files (`cache.php`, `queue.php`, `database.php`). Migrated User API operations to leverage `UserGrpcService` with support for gRPC-based DTO transformations. Updated services and controllers accordingly for consistency and maintainability.
Replaced Redis-based configurations and dependencies with gRPC-driven `UserGrpcService` across controllers and services. Updated Docker configurations to streamline environment setup by eliminating Redis references.
…gRPC response handling and update related controllers and services accordingly
… response, and metadata handling
…r handling, and update method calls for `GetUserProfile` and `GetUser` operations
…r consistency with protobuf field definition
…d enhance error handling in `UserGrpcService`
…rProfile` method, clean up commented code, and adjust Dockerfile for pending gRPC setup.
…P classes Added `GatewayService` protobuf definitions in `apigw.proto`. Generated corresponding PHP classes including `FlexibleRequest`, `FlexibleResponse`, `BytesRequest`, `BytesResponse`, and `ErrorInfo`. Implemented `Apigw` initializer for descriptor pool setup.
…ce` in controllers, enhance `GatewayService` for optimized gRPC client handling, and improve error reporting for downstream services.
…up operations, simplify gRPC client creation in `GatewayService`, and enhance error handling and response formatting
…update `GrpcService` error handling for consistency, and streamline `UserApiController` to proxy requests directly through `GrpcService`.
…treamline `UserApiController` to directly proxy requests through `GrpcService`.
…dling, response consistency, and error reporting; streamline `UserApiController` by removing redundant logic.
…` operation, remove HTTP-based logic, and streamline `UserApiController` by eliminating `UserGrpcService` and `UserService` dependencies.
…rpcService` for `index`, `remove`, and `clear` operations, streamlining request handling and improving consistency.
…rvice`, removing redundant logic for improved consistency and simplicity.
…rvice` for request handling, remove redundant HTTP-based logic, streamline Laravel Octane setup with updated Swoole configuration, and adjust Docker and Supervisor integration for improved reliability.
…input by reference; update controllers and services to align with the change for improved consistency and readability.
…streamline Dockerfile by switching to Debian-based image, simplifying package installation layers, optimizing PHP extension installation, and enhancing gRPC configuration for improved maintainability.
…r clearing all wishlist items
…ing, error reporting, and data inclusion; remove unused `Iterator` dependency and deprecate streaming request logic for better maintainability.
…onvention and add `purchaseHistory` method to `OrderApiController` for retrieving purchase history.
…on` and `composer.lock`, and clean up `cache.php` to remove Octane-specific cache driver configuration.
…roller::getRecommendedProducts` for fetching recommended products, update routes and environment variables for AI service integration, and enhance `docker-compose.yml` configuration.
…t response handling, switch `/recommendations` route to GET, and update AI service URL in `docker-compose.yml`.
…cies, including `UserGrpcService`, `GrpcTransformer`, generated proto files, routes, and service definitions; clean up associated Docker and service configuration files.
…st` calls, comment out excessive logs in `ProductController`, add error logging in `GatewayService`, and clean up unused imports.
…rvice` and `ProductService`) across controllers for consistency and clarity.
…e ProductService, enhance response handling in index method, and add show method for product retrieval.
…N response for HTTP_NOT_FOUND status when no purchased products are found.
…nd BaseGrpcController, and update configurations for gRPC service integration.
…eClientRequest`, rename `forwardToGrpcService` to `forwardGrpcToService`, and update methods across controllers and services for consistency.
… across AuthenticateMiddleware, ShoppingCartApiController, and GatewayService; clean up unused imports and streamline gRPC client creation logic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds support for gRPC by defining new DTOs for user payloads, updating controllers to route and forward gRPC requests, enhancing external API services to include the current user ID in queries, and revising the Dockerfile for protocol buffer and gRPC compatibility.
- Introduce user-focused gRPC DTOs (
UserProfileGrpcDTO,UserListGrpcDTO,UserGrpcDTO, etc.) - Enhance controllers (
BaseGrpcController,AuthController,ProductController) for service routing and authentication - Modify external API services to append user context and overhaul Dockerfile stages for gRPC environment
Reviewed Changes
Copilot reviewed 64 out of 64 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
| app/Grpc/DTOs/User/UserListGrpcDTO.php | Map User model to array, add pagination support |
| app/Grpc/Controllers/BaseGrpcController.php | Extract and log target service name before forwarding requests |
| app/External_Apis/Services/ProductService.php | Append injected user ID to request payload for product queries |
| Dockerfile | Rework build stages, install protobuf tools, add healthcheck |
| 'created_at' => $user->created_at?->toISOString(), | ||
| 'updated_at' => $user->updated_at?->toISOString(), |
Copilot
AI
Jun 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Carbon does not provide toISOString(). Consider using toIso8601String() (or the appropriate Carbon method) to format the timestamp.
| 'created_at' => $user->created_at?->toISOString(), | |
| 'updated_at' => $user->updated_at?->toISOString(), | |
| 'created_at' => $user->created_at?->toIso8601String(), | |
| 'updated_at' => $user->updated_at?->toIso8601String(), |
| 'created_at' => $user->created_at?->toISOString(), | ||
| 'updated_at' => $user->updated_at?->toISOString(), |
Copilot
AI
Jun 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Carbon does not provide toISOString(). Use toIso8601String() (or the correct Carbon API) to serialize updated_at.
| 'created_at' => $user->created_at?->toISOString(), | |
| 'updated_at' => $user->updated_at?->toISOString(), | |
| 'created_at' => $user->created_at?->toIso8601String(), | |
| 'updated_at' => $user->updated_at?->toIso8601String(), |
app/Grpc/DTOs/User/UserGrpcDTO.php
Outdated
| 'created_at' => $user->created_at?->toISOString(), | ||
| 'updated_at' => $user->updated_at?->toISOString(), |
Copilot
AI
Jun 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The toISOString() method is not defined on Carbon. Replace with toIso8601String() or another valid Carbon formatter.
| 'created_at' => $user->created_at?->toISOString(), | |
| 'updated_at' => $user->updated_at?->toISOString(), | |
| 'created_at' => $user->created_at?->toIso8601String(), | |
| 'updated_at' => $user->updated_at?->toIso8601String(), |
app/Grpc/DTOs/User/UserGrpcDTO.php
Outdated
| 'created_at' => $user->created_at?->toISOString(), | ||
| 'updated_at' => $user->updated_at?->toISOString(), |
Copilot
AI
Jun 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace toISOString() with a valid Carbon method such as toIso8601String() to avoid a method-not-found error.
| 'created_at' => $user->created_at?->toISOString(), | |
| 'updated_at' => $user->updated_at?->toISOString(), | |
| 'created_at' => $user->created_at?->toIso8601String(), | |
| 'updated_at' => $user->updated_at?->toIso8601String(), |
… names with constants for improved maintainability.
…nnecessary classes and dependencies.
…/method names with dynamic variables, update response handling, and streamline gRPC integration logic.
…e gRPC error handling in GatewayService
No description provided.