refactor: Align Epic 0 & Epic 1 with true microservices architecture
Refactor core kernel and infrastructure to support true microservices architecture where services are independently deployable. Phase 1: Core Kernel Cleanup - Remove database provider from CoreModule (services create their own) - Update ProvideHealthRegistry to not depend on database - Add schema support to database client (NewClientWithSchema) - Update main entry point to remove database dependency - Core kernel now provides only: config, logger, error bus, health, metrics, tracer, service registry Phase 2: Service Registry Implementation - Create ServiceRegistry interface (pkg/registry/registry.go) - Implement Consul registry (internal/registry/consul/consul.go) - Add Consul dependency (github.com/hashicorp/consul/api) - Add registry configuration to config/default.yaml - Add ProvideServiceRegistry() to DI container Phase 3: Service Client Interfaces - Create service client interfaces: - pkg/services/auth.go - AuthServiceClient - pkg/services/identity.go - IdentityServiceClient - pkg/services/authz.go - AuthzServiceClient - pkg/services/audit.go - AuditServiceClient - Create ServiceClientFactory (internal/client/factory.go) - Create stub gRPC client implementations (internal/client/grpc/) - Add ProvideServiceClientFactory() to DI container Phase 4: gRPC Service Definitions - Create proto files for all core services: - api/proto/auth.proto - api/proto/identity.proto - api/proto/authz.proto - api/proto/audit.proto - Add generate-proto target to Makefile Phase 5: API Gateway Implementation - Create API Gateway service entry point (cmd/api-gateway/main.go) - Create Gateway implementation (services/gateway/gateway.go) - Add gateway configuration to config/default.yaml - Gateway registers with Consul and routes requests to backend services All code compiles successfully. Core services (Auth, Identity, Authz, Audit) will be implemented in Epic 2 using these foundations.
This commit is contained in:
134
api/proto/identity.proto
Normal file
134
api/proto/identity.proto
Normal file
@@ -0,0 +1,134 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package identity.v1;
|
||||
|
||||
option go_package = "git.dcentral.systems/toolz/goplt/api/proto/generated/identity/v1;identityv1";
|
||||
|
||||
// IdentityService provides user management operations.
|
||||
service IdentityService {
|
||||
// GetUser retrieves a user by ID.
|
||||
rpc GetUser(GetUserRequest) returns (GetUserResponse);
|
||||
|
||||
// GetUserByEmail retrieves a user by email address.
|
||||
rpc GetUserByEmail(GetUserByEmailRequest) returns (GetUserByEmailResponse);
|
||||
|
||||
// CreateUser creates a new user.
|
||||
rpc CreateUser(CreateUserRequest) returns (CreateUserResponse);
|
||||
|
||||
// UpdateUser updates an existing user.
|
||||
rpc UpdateUser(UpdateUserRequest) returns (UpdateUserResponse);
|
||||
|
||||
// DeleteUser deletes a user.
|
||||
rpc DeleteUser(DeleteUserRequest) returns (DeleteUserResponse);
|
||||
|
||||
// VerifyEmail verifies a user's email address using a verification token.
|
||||
rpc VerifyEmail(VerifyEmailRequest) returns (VerifyEmailResponse);
|
||||
|
||||
// RequestPasswordReset requests a password reset token.
|
||||
rpc RequestPasswordReset(RequestPasswordResetRequest) returns (RequestPasswordResetResponse);
|
||||
|
||||
// ResetPassword resets a user's password using a reset token.
|
||||
rpc ResetPassword(ResetPasswordRequest) returns (ResetPasswordResponse);
|
||||
}
|
||||
|
||||
// User represents a user in the system.
|
||||
message User {
|
||||
string id = 1;
|
||||
string email = 2;
|
||||
string username = 3;
|
||||
string first_name = 4;
|
||||
string last_name = 5;
|
||||
bool email_verified = 6;
|
||||
int64 created_at = 7;
|
||||
int64 updated_at = 8;
|
||||
}
|
||||
|
||||
// GetUserRequest contains a user ID.
|
||||
message GetUserRequest {
|
||||
string id = 1;
|
||||
}
|
||||
|
||||
// GetUserResponse contains a user.
|
||||
message GetUserResponse {
|
||||
User user = 1;
|
||||
}
|
||||
|
||||
// GetUserByEmailRequest contains an email address.
|
||||
message GetUserByEmailRequest {
|
||||
string email = 1;
|
||||
}
|
||||
|
||||
// GetUserByEmailResponse contains a user.
|
||||
message GetUserByEmailResponse {
|
||||
User user = 1;
|
||||
}
|
||||
|
||||
// CreateUserRequest contains user data for creation.
|
||||
message CreateUserRequest {
|
||||
string email = 1;
|
||||
string username = 2;
|
||||
string password = 3;
|
||||
string first_name = 4;
|
||||
string last_name = 5;
|
||||
}
|
||||
|
||||
// CreateUserResponse contains the created user.
|
||||
message CreateUserResponse {
|
||||
User user = 1;
|
||||
}
|
||||
|
||||
// UpdateUserRequest contains user data for update.
|
||||
message UpdateUserRequest {
|
||||
string id = 1;
|
||||
optional string email = 2;
|
||||
optional string username = 3;
|
||||
optional string first_name = 4;
|
||||
optional string last_name = 5;
|
||||
}
|
||||
|
||||
// UpdateUserResponse contains the updated user.
|
||||
message UpdateUserResponse {
|
||||
User user = 1;
|
||||
}
|
||||
|
||||
// DeleteUserRequest contains a user ID.
|
||||
message DeleteUserRequest {
|
||||
string id = 1;
|
||||
}
|
||||
|
||||
// DeleteUserResponse indicates success.
|
||||
message DeleteUserResponse {
|
||||
bool success = 1;
|
||||
}
|
||||
|
||||
// VerifyEmailRequest contains a verification token.
|
||||
message VerifyEmailRequest {
|
||||
string token = 1;
|
||||
}
|
||||
|
||||
// VerifyEmailResponse indicates success.
|
||||
message VerifyEmailResponse {
|
||||
bool success = 1;
|
||||
}
|
||||
|
||||
// RequestPasswordResetRequest contains an email address.
|
||||
message RequestPasswordResetRequest {
|
||||
string email = 1;
|
||||
}
|
||||
|
||||
// RequestPasswordResetResponse indicates success.
|
||||
message RequestPasswordResetResponse {
|
||||
bool success = 1;
|
||||
}
|
||||
|
||||
// ResetPasswordRequest contains a reset token and new password.
|
||||
message ResetPasswordRequest {
|
||||
string token = 1;
|
||||
string new_password = 2;
|
||||
}
|
||||
|
||||
// ResetPasswordResponse indicates success.
|
||||
message ResetPasswordResponse {
|
||||
bool success = 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user