Skip to content

Conversation

@OmmrGAZAR315
Copy link
Contributor

…e to streamline the codebase.

@OmmrGAZAR315 OmmrGAZAR315 requested a review from Copilot June 13, 2025 02:27

This comment was marked as outdated.

…, controllers, and request/response handling. Integrate `GrpcServiceProvider` and update configuration and bootstrap files.
…eamline request handling, and introduce `CartController`. Update Docker environment variables and image version for compatibility. Remove unused gRPC config.
…ust method visibility, and refine service definitions.
@OmmrGAZAR315 OmmrGAZAR315 requested a review from Copilot June 14, 2025 00:46
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR removes obsolete proto-generated gRPC files and classes, streamlines service routing, and introduces a dynamic gateway for handling flexible gRPC requests.

  • Deleted unused HealthService and GPBMetadata proto artifacts.
  • Added GrpcRouteRegistry and GrpcServiceRouter for dynamic service/method routing.
  • Introduced UserGrpcService and updated Cart/HTTP proxy services to use a gateway pattern.

Reviewed Changes

Copilot reviewed 51 out of 51 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
app/Grpc/Services/UserGrpcService.php Added gateway service to forward flexible gRPC calls
app/Grpc/Services/GrpcService.php New HTTP-to-gRPC proxy (proxyRequest/dispatchGrpcRequest)
app/Grpc/GrpcRouteRegistry.php New static registry for service-method mappings
app/Grpc/GrpcRoute.php Fluent interface for registering gRPC routes
app/Console/Commands/GrpcServeCommand.php Updated server command to handle UserGrpcService
app/Grpc/GPBMetadata/User/UserService.php Removed generated proto metadata for UserService

$responseData = new Any();
$resource = new UserResource($user);
$responseData->setValue(json_encode([
'data' => $resource
Copy link

Copilot AI Jun 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Passing a UserResource object directly into json_encode may not yield the expected structure; consider converting it to an array (e.g., $resource->toArray()) before encoding.

Suggested change
'data' => $resource
'data' => $resource->toArray()

Copilot uses AI. Check for mistakes.

namespace App\Grpc\Services;

use App\Grpc\Controllers\BaseGrpcService;
Copy link

Copilot AI Jun 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The BaseGrpcService import is not referenced in this file; remove the unused import to clean up the code.

Suggested change
use App\Grpc\Controllers\BaseGrpcService;

Copilot uses AI. Check for mistakes.
Comment on lines +53 to +54
if ($bearerToken = request()->bearerToken())
$metadata['authorization'] = ['Bearer ' . $bearerToken];
Copy link

Copilot AI Jun 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Use braces for the if statement to avoid ambiguity and make future expansions safer (e.g., if (...) { ... }).

Suggested change
if ($bearerToken = request()->bearerToken())
$metadata['authorization'] = ['Bearer ' . $bearerToken];
if ($bearerToken = request()->bearerToken()) {
$metadata['authorization'] = ['Bearer ' . $bearerToken];
}

Copilot uses AI. Check for mistakes.
@OmmrGAZAR315 OmmrGAZAR315 self-assigned this Jun 14, 2025
OmmrGAZAR315 and others added 8 commits June 14, 2025 03:49
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…methods, simplify request handling, and adjust service definitions for improved consistency and maintainability.
…pdate ProductHandler for dependency injection
…cAuthMiddleware`, and migrate `logout` method from UserServer.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants