chore(infra): add gRPC layer, update protobufs, remove immediate module

- Add gRPC service modules: auth, channel, channel settings, member,
  permission
- Update protobuf definitions and generated code
- Remove immediate/ real-time module (superseded by IM service)
- Update etcd discovery and registration
- Update cache, error, config, and build infrastructure
- Add ADR documentation
- Update OpenAPI spec
This commit is contained in:
zhenyi
2026-06-10 18:49:42 +08:00
parent 9eb77ab98b
commit 1000f8a80d
57 changed files with 22524 additions and 2703 deletions
+212
View File
@@ -0,0 +1,212 @@
syntax = "proto3";
package appks.im.v1;
import "google/protobuf/timestamp.proto";
// Channel management service for the IM microservice.
// Provides CRUD for channels and categories, plus channel statistics.
// ── Enums ──────────────────────────────────────────────────────────────
enum ChannelType {
CHANNEL_TYPE_UNSPECIFIED = 0;
CHANNEL_TYPE_PUBLIC = 1;
CHANNEL_TYPE_PRIVATE = 2;
CHANNEL_TYPE_DIRECT = 3;
CHANNEL_TYPE_GROUP = 4;
CHANNEL_TYPE_REPO = 5;
CHANNEL_TYPE_SYSTEM = 6;
}
enum ChannelKind {
CHANNEL_KIND_UNSPECIFIED = 0;
CHANNEL_KIND_TEXT = 1;
CHANNEL_KIND_VOICE = 2;
CHANNEL_KIND_STAGE = 3;
CHANNEL_KIND_FORUM = 4;
CHANNEL_KIND_ANNOUNCEMENT = 5;
}
enum Visibility {
VISIBILITY_UNSPECIFIED = 0;
VISIBILITY_PUBLIC = 1;
VISIBILITY_PRIVATE = 2;
VISIBILITY_INTERNAL = 3;
VISIBILITY_WORKSPACE = 4;
VISIBILITY_PROTECTED = 5;
VISIBILITY_HIDDEN = 6;
VISIBILITY_SECRET = 7;
}
// ── Messages ───────────────────────────────────────────────────────────
message Channel {
string id = 1;
string workspace_id = 2;
optional string category_id = 3;
optional string parent_channel_id = 4;
string name = 5;
optional string topic = 6;
optional string description = 7;
ChannelType channel_type = 8;
ChannelKind channel_kind = 9;
Visibility visibility = 10;
int32 position = 11;
bool nsfw = 12;
bool read_only = 13;
bool archived = 14;
optional string created_by = 15;
optional int32 rate_limit_per_user = 16;
optional google.protobuf.Timestamp archived_at = 17;
optional string last_message_id = 18;
optional google.protobuf.Timestamp last_message_at = 19;
google.protobuf.Timestamp created_at = 20;
google.protobuf.Timestamp updated_at = 21;
}
message ChannelStats {
string channel_id = 1;
int32 members_count = 2;
int32 messages_count = 3;
int32 threads_count = 4;
int32 reactions_count = 5;
int32 mentions_count = 6;
int32 files_count = 7;
optional google.protobuf.Timestamp last_activity_at = 8;
google.protobuf.Timestamp updated_at = 9;
}
message ChannelCategory {
string id = 1;
string workspace_id = 2;
string name = 3;
int32 position = 4;
bool collapsed = 5;
google.protobuf.Timestamp created_at = 6;
google.protobuf.Timestamp updated_at = 7;
}
// ── Requests / Responses ──────────────────────────────────────────────
message GetChannelRequest {
string channel_id = 1;
}
message GetChannelResponse {
Channel channel = 1;
}
message ListChannelsRequest {
string workspace_name = 1;
optional string category_id = 2;
optional ChannelType channel_type = 3;
optional ChannelKind channel_kind = 4;
int32 limit = 5;
int32 offset = 6;
}
message ListChannelsResponse {
repeated Channel channels = 1;
int32 total = 2;
}
message CreateChannelRequest {
string workspace_name = 1;
string name = 2;
optional string topic = 3;
optional string description = 4;
optional string channel_type = 5;
optional string channel_kind = 6;
optional string visibility = 7;
optional string category_id = 8;
optional string parent_channel_id = 9;
optional string created_by = 10;
optional int32 rate_limit_per_user = 11;
}
message CreateChannelResponse {
Channel channel = 1;
}
message UpdateChannelRequest {
string channel_id = 1;
optional string name = 2;
optional string topic = 3;
optional string description = 4;
optional string visibility = 5;
optional int32 position = 6;
optional bool nsfw = 7;
optional bool read_only = 8;
optional bool archived = 9;
optional string category_id = 10;
optional int32 rate_limit_per_user = 11;
}
message UpdateChannelResponse {
Channel channel = 1;
}
message DeleteChannelRequest {
string channel_id = 1;
}
message DeleteChannelResponse {}
message GetChannelStatsRequest {
string channel_id = 1;
}
message GetChannelStatsResponse {
ChannelStats stats = 1;
}
message ListCategoriesRequest {
string workspace_name = 1;
}
message ListCategoriesResponse {
repeated ChannelCategory categories = 1;
}
message CreateCategoryRequest {
string workspace_name = 1;
string name = 2;
optional int32 position = 3;
}
message CreateCategoryResponse {
ChannelCategory category = 1;
}
message UpdateCategoryRequest {
string category_id = 1;
optional string name = 2;
optional int32 position = 3;
optional bool collapsed = 4;
}
message UpdateCategoryResponse {
ChannelCategory category = 1;
}
message DeleteCategoryRequest {
string category_id = 1;
}
message DeleteCategoryResponse {}
// ── Service ───────────────────────────────────────────────────────────
service ChannelService {
rpc GetChannel(GetChannelRequest) returns (GetChannelResponse);
rpc ListChannels(ListChannelsRequest) returns (ListChannelsResponse);
rpc CreateChannel(CreateChannelRequest) returns (CreateChannelResponse);
rpc UpdateChannel(UpdateChannelRequest) returns (UpdateChannelResponse);
rpc DeleteChannel(DeleteChannelRequest) returns (DeleteChannelResponse);
rpc GetChannelStats(GetChannelStatsRequest) returns (GetChannelStatsResponse);
rpc ListCategories(ListCategoriesRequest) returns (ListCategoriesResponse);
rpc CreateCategory(CreateCategoryRequest) returns (CreateCategoryResponse);
rpc UpdateCategory(UpdateCategoryRequest) returns (UpdateCategoryResponse);
rpc DeleteCategory(DeleteCategoryRequest) returns (DeleteCategoryResponse);
}