users methods
All checks were successful
docker / build-docker (push) Successful in 3m18s

This commit is contained in:
royalcat 2024-12-25 21:22:29 +03:00
parent 6d84b8480f
commit 5da11dc01b
10 changed files with 564 additions and 55 deletions

View file

@ -5,10 +5,14 @@ package konfa.server.v1;
option go_package = "/serverv1"; option go_package = "/serverv1";
// import "google/protobuf/timestamp.proto"; // import "google/protobuf/timestamp.proto";
import "konfa/user/v1/user.proto";
import "konfa/channel/v1/channels.proto"; import "konfa/channel/v1/channels.proto";
service ServerService { service ServerService {
rpc ListServerChannels(ListServerChannelsRequest) returns (ListServerChannelsResponse) {} rpc ListServerChannels(ListServerChannelsRequest) returns (ListServerChannelsResponse) {}
rpc ListServerUsers(ListServerUsersRequest) returns (ListServerUsersResponse) {}
rpc GetUser(GetUserRequest) returns (GetUserResponse) {}
} }
message ListServerChannelsRequest { message ListServerChannelsRequest {
@ -18,3 +22,19 @@ message ListServerChannelsRequest {
message ListServerChannelsResponse { message ListServerChannelsResponse {
repeated konfa.channel.v1.Channel channels = 1; repeated konfa.channel.v1.Channel channels = 1;
} }
message ListServerUsersRequest {
string server_id = 1;
}
message ListServerUsersResponse {
repeated konfa.user.v1.User users = 1;
}
message GetUserRequest {
string user_id = 1;
}
message GetUserResponse {
konfa.user.v1.User user = 1;
}

View file

@ -0,0 +1,12 @@
syntax = "proto3";
package konfa.user.v1;
option go_package = "/userv1";
// import "google/protobuf/timestamp.proto";
message User {
string id = 1;
string username = 2;
}

View file

@ -5,18 +5,9 @@ import (
"github.com/royalcat/konfa-server/pkg/uuid" "github.com/royalcat/konfa-server/pkg/uuid"
"github.com/royalcat/konfa-server/src/store" "github.com/royalcat/konfa-server/src/store"
"github.com/uptrace/bun"
) )
type Users struct { func (u *Service) GetUser(ctx context.Context, id uuid.UUID) (store.User, error) {
db *bun.DB
}
func NewUsers(db *bun.DB) *Users {
return &Users{db: db}
}
func (u *Users) GetUser(ctx context.Context, id uuid.UUID) (store.User, error) {
var user store.User var user store.User
err := u.db.NewSelect(). err := u.db.NewSelect().
Model(&user). Model(&user).
@ -24,3 +15,11 @@ func (u *Users) GetUser(ctx context.Context, id uuid.UUID) (store.User, error) {
Scan(ctx) Scan(ctx)
return user, err return user, err
} }
func (u *Service) ListServerUser(ctx context.Context, serverID uuid.UUID) ([]store.User, error) {
var users []store.User
err := u.db.NewSelect().
Model(&users).
Scan(ctx)
return users, err
}

View file

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.36.0 // protoc-gen-go v1.36.1
// protoc (unknown) // protoc (unknown)
// source: konfa/channel/v1/channels.proto // source: konfa/channel/v1/channels.proto

View file

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.36.0 // protoc-gen-go v1.36.1
// protoc (unknown) // protoc (unknown)
// source: konfa/chat/v1/service.proto // source: konfa/chat/v1/service.proto

View file

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.36.0 // protoc-gen-go v1.36.1
// protoc (unknown) // protoc (unknown)
// source: konfa/server/v1/service.proto // source: konfa/server/v1/service.proto
@ -8,6 +8,7 @@ package serverv1
import ( import (
v1 "github.com/royalcat/konfa-server/src/proto/konfa/channel/v1" v1 "github.com/royalcat/konfa-server/src/proto/konfa/channel/v1"
v11 "github.com/royalcat/konfa-server/src/proto/konfa/user/v1"
protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl" protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect" reflect "reflect"
@ -109,45 +110,248 @@ func (x *ListServerChannelsResponse) GetChannels() []*v1.Channel {
return nil return nil
} }
type ListServerUsersRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
ServerId string `protobuf:"bytes,1,opt,name=server_id,json=serverId,proto3" json:"server_id,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *ListServerUsersRequest) Reset() {
*x = ListServerUsersRequest{}
mi := &file_konfa_server_v1_service_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *ListServerUsersRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ListServerUsersRequest) ProtoMessage() {}
func (x *ListServerUsersRequest) ProtoReflect() protoreflect.Message {
mi := &file_konfa_server_v1_service_proto_msgTypes[2]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ListServerUsersRequest.ProtoReflect.Descriptor instead.
func (*ListServerUsersRequest) Descriptor() ([]byte, []int) {
return file_konfa_server_v1_service_proto_rawDescGZIP(), []int{2}
}
func (x *ListServerUsersRequest) GetServerId() string {
if x != nil {
return x.ServerId
}
return ""
}
type ListServerUsersResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
Users []*v11.User `protobuf:"bytes,1,rep,name=users,proto3" json:"users,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *ListServerUsersResponse) Reset() {
*x = ListServerUsersResponse{}
mi := &file_konfa_server_v1_service_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *ListServerUsersResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ListServerUsersResponse) ProtoMessage() {}
func (x *ListServerUsersResponse) ProtoReflect() protoreflect.Message {
mi := &file_konfa_server_v1_service_proto_msgTypes[3]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ListServerUsersResponse.ProtoReflect.Descriptor instead.
func (*ListServerUsersResponse) Descriptor() ([]byte, []int) {
return file_konfa_server_v1_service_proto_rawDescGZIP(), []int{3}
}
func (x *ListServerUsersResponse) GetUsers() []*v11.User {
if x != nil {
return x.Users
}
return nil
}
type GetUserRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *GetUserRequest) Reset() {
*x = GetUserRequest{}
mi := &file_konfa_server_v1_service_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *GetUserRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetUserRequest) ProtoMessage() {}
func (x *GetUserRequest) ProtoReflect() protoreflect.Message {
mi := &file_konfa_server_v1_service_proto_msgTypes[4]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetUserRequest.ProtoReflect.Descriptor instead.
func (*GetUserRequest) Descriptor() ([]byte, []int) {
return file_konfa_server_v1_service_proto_rawDescGZIP(), []int{4}
}
func (x *GetUserRequest) GetUserId() string {
if x != nil {
return x.UserId
}
return ""
}
type GetUserResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
User *v11.User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *GetUserResponse) Reset() {
*x = GetUserResponse{}
mi := &file_konfa_server_v1_service_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *GetUserResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetUserResponse) ProtoMessage() {}
func (x *GetUserResponse) ProtoReflect() protoreflect.Message {
mi := &file_konfa_server_v1_service_proto_msgTypes[5]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetUserResponse.ProtoReflect.Descriptor instead.
func (*GetUserResponse) Descriptor() ([]byte, []int) {
return file_konfa_server_v1_service_proto_rawDescGZIP(), []int{5}
}
func (x *GetUserResponse) GetUser() *v11.User {
if x != nil {
return x.User
}
return nil
}
var File_konfa_server_v1_service_proto protoreflect.FileDescriptor var File_konfa_server_v1_service_proto protoreflect.FileDescriptor
var file_konfa_server_v1_service_proto_rawDesc = []byte{ var file_konfa_server_v1_service_proto_rawDesc = []byte{
0x0a, 0x1d, 0x6b, 0x6f, 0x6e, 0x66, 0x61, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x76, 0x0a, 0x1d, 0x6b, 0x6f, 0x6e, 0x66, 0x61, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x76,
0x31, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x31, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12,
0x0f, 0x6b, 0x6f, 0x6e, 0x66, 0x61, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x0f, 0x6b, 0x6f, 0x6e, 0x66, 0x61, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x76, 0x31,
0x1a, 0x1f, 0x6b, 0x6f, 0x6e, 0x66, 0x61, 0x2f, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x2f, 0x1a, 0x18, 0x6b, 0x6f, 0x6e, 0x66, 0x61, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x2f,
0x76, 0x31, 0x2f, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x6b, 0x6f, 0x6e, 0x66,
0x6f, 0x22, 0x38, 0x0a, 0x19, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x43, 0x61, 0x2f, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x68, 0x61,
0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x6e, 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x38, 0x0a, 0x19, 0x4c,
0x0a, 0x09, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
0x09, 0x52, 0x08, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x49, 0x64, 0x22, 0x53, 0x0a, 0x1a, 0x4c,
0x69, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c,
0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x35, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x65, 0x72, 0x76,
0x6e, 0x6e, 0x65, 0x6c, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6b, 0x6f, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x65, 0x72,
0x6e, 0x66, 0x61, 0x2e, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x76, 0x65, 0x72, 0x49, 0x64, 0x22, 0x53, 0x0a, 0x1a, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x72,
0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x08, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x73, 0x76, 0x65, 0x72, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x32, 0x80, 0x01, 0x0a, 0x0d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x6e, 0x73, 0x65, 0x12, 0x35, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x73, 0x18,
0x63, 0x65, 0x12, 0x6f, 0x0a, 0x12, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6b, 0x6f, 0x6e, 0x66, 0x61, 0x2e, 0x63, 0x68,
0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x73, 0x12, 0x2a, 0x2e, 0x6b, 0x6f, 0x6e, 0x66, 0x61, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c,
0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x52, 0x08, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x73, 0x22, 0x35, 0x0a, 0x16, 0x4c, 0x69,
0x65, 0x72, 0x76, 0x65, 0x72, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x73, 0x52, 0x65, 0x71, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x6b, 0x6f, 0x6e, 0x66, 0x61, 0x2e, 0x73, 0x65, 0x72, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x69,
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x49,
0x64, 0x22, 0x44, 0x0a, 0x17, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x55,
0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x29, 0x0a, 0x05,
0x75, 0x73, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6b, 0x6f,
0x6e, 0x66, 0x61, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72,
0x52, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, 0x22, 0x29, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x55, 0x73,
0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65,
0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72,
0x49, 0x64, 0x22, 0x3a, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x27, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6b, 0x6f, 0x6e, 0x66, 0x61, 0x2e, 0x75, 0x73, 0x65, 0x72,
0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x32, 0xb8,
0x02, 0x0a, 0x0d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
0x12, 0x6f, 0x0a, 0x12, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x43, 0x68,
0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x73, 0x12, 0x2a, 0x2e, 0x6b, 0x6f, 0x6e, 0x66, 0x61, 0x2e, 0x73,
0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x72,
0x76, 0x65, 0x72, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x6b, 0x6f, 0x6e, 0x66, 0x61, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65,
0x72, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x43,
0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22,
0x00, 0x12, 0x66, 0x0a, 0x0f, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x55,
0x73, 0x65, 0x72, 0x73, 0x12, 0x27, 0x2e, 0x6b, 0x6f, 0x6e, 0x66, 0x61, 0x2e, 0x73, 0x65, 0x72,
0x76, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x76, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65,
0x72, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x72, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e,
0x65, 0x22, 0x00, 0x42, 0xc6, 0x01, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x6b, 0x6f, 0x6e, 0x66, 0x6b, 0x6f, 0x6e, 0x66, 0x61, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e,
0x61, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x42, 0x0c, 0x53, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52,
0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x43, 0x67, 0x69, 0x74, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4e, 0x0a, 0x07, 0x47, 0x65, 0x74,
0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x72, 0x6f, 0x79, 0x61, 0x6c, 0x63, 0x61, 0x74, 0x55, 0x73, 0x65, 0x72, 0x12, 0x1f, 0x2e, 0x6b, 0x6f, 0x6e, 0x66, 0x61, 0x2e, 0x73, 0x65, 0x72,
0x2f, 0x6b, 0x6f, 0x6e, 0x66, 0x61, 0x2d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x73, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65,
0x63, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6b, 0x6f, 0x6e, 0x66, 0x61, 0x2f, 0x73, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6b, 0x6f, 0x6e, 0x66, 0x61, 0x2e, 0x73, 0x65,
0x72, 0x76, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x3b, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x76, 0x31, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52,
0xa2, 0x02, 0x03, 0x4b, 0x53, 0x58, 0xaa, 0x02, 0x0f, 0x4b, 0x6f, 0x6e, 0x66, 0x61, 0x2e, 0x53, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0xc6, 0x01, 0x0a, 0x13, 0x63, 0x6f,
0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0f, 0x4b, 0x6f, 0x6e, 0x66, 0x61, 0x6d, 0x2e, 0x6b, 0x6f, 0x6e, 0x66, 0x61, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x76,
0x5c, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1b, 0x4b, 0x6f, 0x6e, 0x31, 0x42, 0x0c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50,
0x66, 0x61, 0x5c, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x01, 0x5a, 0x43, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x72, 0x6f,
0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x11, 0x4b, 0x6f, 0x6e, 0x66, 0x61, 0x79, 0x61, 0x6c, 0x63, 0x61, 0x74, 0x2f, 0x6b, 0x6f, 0x6e, 0x66, 0x61, 0x2d, 0x73, 0x65, 0x72,
0x3a, 0x3a, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x73, 0x72, 0x63, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6b, 0x6f,
0x6f, 0x74, 0x6f, 0x33, 0x6e, 0x66, 0x61, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x3b, 0x73, 0x65,
0x72, 0x76, 0x65, 0x72, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x4b, 0x53, 0x58, 0xaa, 0x02, 0x0f, 0x4b,
0x6f, 0x6e, 0x66, 0x61, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x56, 0x31, 0xca, 0x02,
0x0f, 0x4b, 0x6f, 0x6e, 0x66, 0x61, 0x5c, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5c, 0x56, 0x31,
0xe2, 0x02, 0x1b, 0x4b, 0x6f, 0x6e, 0x66, 0x61, 0x5c, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5c,
0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02,
0x11, 0x4b, 0x6f, 0x6e, 0x66, 0x61, 0x3a, 0x3a, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x3a, 0x3a,
0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (
@ -162,21 +366,32 @@ func file_konfa_server_v1_service_proto_rawDescGZIP() []byte {
return file_konfa_server_v1_service_proto_rawDescData return file_konfa_server_v1_service_proto_rawDescData
} }
var file_konfa_server_v1_service_proto_msgTypes = make([]protoimpl.MessageInfo, 2) var file_konfa_server_v1_service_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
var file_konfa_server_v1_service_proto_goTypes = []any{ var file_konfa_server_v1_service_proto_goTypes = []any{
(*ListServerChannelsRequest)(nil), // 0: konfa.server.v1.ListServerChannelsRequest (*ListServerChannelsRequest)(nil), // 0: konfa.server.v1.ListServerChannelsRequest
(*ListServerChannelsResponse)(nil), // 1: konfa.server.v1.ListServerChannelsResponse (*ListServerChannelsResponse)(nil), // 1: konfa.server.v1.ListServerChannelsResponse
(*v1.Channel)(nil), // 2: konfa.channel.v1.Channel (*ListServerUsersRequest)(nil), // 2: konfa.server.v1.ListServerUsersRequest
(*ListServerUsersResponse)(nil), // 3: konfa.server.v1.ListServerUsersResponse
(*GetUserRequest)(nil), // 4: konfa.server.v1.GetUserRequest
(*GetUserResponse)(nil), // 5: konfa.server.v1.GetUserResponse
(*v1.Channel)(nil), // 6: konfa.channel.v1.Channel
(*v11.User)(nil), // 7: konfa.user.v1.User
} }
var file_konfa_server_v1_service_proto_depIdxs = []int32{ var file_konfa_server_v1_service_proto_depIdxs = []int32{
2, // 0: konfa.server.v1.ListServerChannelsResponse.channels:type_name -> konfa.channel.v1.Channel 6, // 0: konfa.server.v1.ListServerChannelsResponse.channels:type_name -> konfa.channel.v1.Channel
0, // 1: konfa.server.v1.ServerService.ListServerChannels:input_type -> konfa.server.v1.ListServerChannelsRequest 7, // 1: konfa.server.v1.ListServerUsersResponse.users:type_name -> konfa.user.v1.User
1, // 2: konfa.server.v1.ServerService.ListServerChannels:output_type -> konfa.server.v1.ListServerChannelsResponse 7, // 2: konfa.server.v1.GetUserResponse.user:type_name -> konfa.user.v1.User
2, // [2:3] is the sub-list for method output_type 0, // 3: konfa.server.v1.ServerService.ListServerChannels:input_type -> konfa.server.v1.ListServerChannelsRequest
1, // [1:2] is the sub-list for method input_type 2, // 4: konfa.server.v1.ServerService.ListServerUsers:input_type -> konfa.server.v1.ListServerUsersRequest
1, // [1:1] is the sub-list for extension type_name 4, // 5: konfa.server.v1.ServerService.GetUser:input_type -> konfa.server.v1.GetUserRequest
1, // [1:1] is the sub-list for extension extendee 1, // 6: konfa.server.v1.ServerService.ListServerChannels:output_type -> konfa.server.v1.ListServerChannelsResponse
0, // [0:1] is the sub-list for field type_name 3, // 7: konfa.server.v1.ServerService.ListServerUsers:output_type -> konfa.server.v1.ListServerUsersResponse
5, // 8: konfa.server.v1.ServerService.GetUser:output_type -> konfa.server.v1.GetUserResponse
6, // [6:9] is the sub-list for method output_type
3, // [3:6] is the sub-list for method input_type
3, // [3:3] is the sub-list for extension type_name
3, // [3:3] is the sub-list for extension extendee
0, // [0:3] is the sub-list for field type_name
} }
func init() { file_konfa_server_v1_service_proto_init() } func init() { file_konfa_server_v1_service_proto_init() }
@ -190,7 +405,7 @@ func file_konfa_server_v1_service_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_konfa_server_v1_service_proto_rawDesc, RawDescriptor: file_konfa_server_v1_service_proto_rawDesc,
NumEnums: 0, NumEnums: 0,
NumMessages: 2, NumMessages: 6,
NumExtensions: 0, NumExtensions: 0,
NumServices: 1, NumServices: 1,
}, },

View file

@ -20,6 +20,8 @@ const _ = grpc.SupportPackageIsVersion9
const ( const (
ServerService_ListServerChannels_FullMethodName = "/konfa.server.v1.ServerService/ListServerChannels" ServerService_ListServerChannels_FullMethodName = "/konfa.server.v1.ServerService/ListServerChannels"
ServerService_ListServerUsers_FullMethodName = "/konfa.server.v1.ServerService/ListServerUsers"
ServerService_GetUser_FullMethodName = "/konfa.server.v1.ServerService/GetUser"
) )
// ServerServiceClient is the client API for ServerService service. // ServerServiceClient is the client API for ServerService service.
@ -27,6 +29,8 @@ const (
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type ServerServiceClient interface { type ServerServiceClient interface {
ListServerChannels(ctx context.Context, in *ListServerChannelsRequest, opts ...grpc.CallOption) (*ListServerChannelsResponse, error) ListServerChannels(ctx context.Context, in *ListServerChannelsRequest, opts ...grpc.CallOption) (*ListServerChannelsResponse, error)
ListServerUsers(ctx context.Context, in *ListServerUsersRequest, opts ...grpc.CallOption) (*ListServerUsersResponse, error)
GetUser(ctx context.Context, in *GetUserRequest, opts ...grpc.CallOption) (*GetUserResponse, error)
} }
type serverServiceClient struct { type serverServiceClient struct {
@ -47,11 +51,33 @@ func (c *serverServiceClient) ListServerChannels(ctx context.Context, in *ListSe
return out, nil return out, nil
} }
func (c *serverServiceClient) ListServerUsers(ctx context.Context, in *ListServerUsersRequest, opts ...grpc.CallOption) (*ListServerUsersResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ListServerUsersResponse)
err := c.cc.Invoke(ctx, ServerService_ListServerUsers_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *serverServiceClient) GetUser(ctx context.Context, in *GetUserRequest, opts ...grpc.CallOption) (*GetUserResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetUserResponse)
err := c.cc.Invoke(ctx, ServerService_GetUser_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// ServerServiceServer is the server API for ServerService service. // ServerServiceServer is the server API for ServerService service.
// All implementations should embed UnimplementedServerServiceServer // All implementations should embed UnimplementedServerServiceServer
// for forward compatibility. // for forward compatibility.
type ServerServiceServer interface { type ServerServiceServer interface {
ListServerChannels(context.Context, *ListServerChannelsRequest) (*ListServerChannelsResponse, error) ListServerChannels(context.Context, *ListServerChannelsRequest) (*ListServerChannelsResponse, error)
ListServerUsers(context.Context, *ListServerUsersRequest) (*ListServerUsersResponse, error)
GetUser(context.Context, *GetUserRequest) (*GetUserResponse, error)
} }
// UnimplementedServerServiceServer should be embedded to have // UnimplementedServerServiceServer should be embedded to have
@ -64,6 +90,12 @@ type UnimplementedServerServiceServer struct{}
func (UnimplementedServerServiceServer) ListServerChannels(context.Context, *ListServerChannelsRequest) (*ListServerChannelsResponse, error) { func (UnimplementedServerServiceServer) ListServerChannels(context.Context, *ListServerChannelsRequest) (*ListServerChannelsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ListServerChannels not implemented") return nil, status.Errorf(codes.Unimplemented, "method ListServerChannels not implemented")
} }
func (UnimplementedServerServiceServer) ListServerUsers(context.Context, *ListServerUsersRequest) (*ListServerUsersResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ListServerUsers not implemented")
}
func (UnimplementedServerServiceServer) GetUser(context.Context, *GetUserRequest) (*GetUserResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetUser not implemented")
}
func (UnimplementedServerServiceServer) testEmbeddedByValue() {} func (UnimplementedServerServiceServer) testEmbeddedByValue() {}
// UnsafeServerServiceServer may be embedded to opt out of forward compatibility for this service. // UnsafeServerServiceServer may be embedded to opt out of forward compatibility for this service.
@ -102,6 +134,42 @@ func _ServerService_ListServerChannels_Handler(srv interface{}, ctx context.Cont
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _ServerService_ListServerUsers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ListServerUsersRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ServerServiceServer).ListServerUsers(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: ServerService_ListServerUsers_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ServerServiceServer).ListServerUsers(ctx, req.(*ListServerUsersRequest))
}
return interceptor(ctx, in, info, handler)
}
func _ServerService_GetUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetUserRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ServerServiceServer).GetUser(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: ServerService_GetUser_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ServerServiceServer).GetUser(ctx, req.(*GetUserRequest))
}
return interceptor(ctx, in, info, handler)
}
// ServerService_ServiceDesc is the grpc.ServiceDesc for ServerService service. // ServerService_ServiceDesc is the grpc.ServiceDesc for ServerService service.
// It's only intended for direct use with grpc.RegisterService, // It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy) // and not to be introspected or modified (even as a copy)
@ -113,6 +181,14 @@ var ServerService_ServiceDesc = grpc.ServiceDesc{
MethodName: "ListServerChannels", MethodName: "ListServerChannels",
Handler: _ServerService_ListServerChannels_Handler, Handler: _ServerService_ListServerChannels_Handler,
}, },
{
MethodName: "ListServerUsers",
Handler: _ServerService_ListServerUsers_Handler,
},
{
MethodName: "GetUser",
Handler: _ServerService_GetUser_Handler,
},
}, },
Streams: []grpc.StreamDesc{}, Streams: []grpc.StreamDesc{},
Metadata: "konfa/server/v1/service.proto", Metadata: "konfa/server/v1/service.proto",

View file

@ -0,0 +1,145 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.1
// protoc (unknown)
// source: konfa/user/v1/user.proto
package userv1
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type User struct {
state protoimpl.MessageState `protogen:"open.v1"`
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *User) Reset() {
*x = User{}
mi := &file_konfa_user_v1_user_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *User) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*User) ProtoMessage() {}
func (x *User) ProtoReflect() protoreflect.Message {
mi := &file_konfa_user_v1_user_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use User.ProtoReflect.Descriptor instead.
func (*User) Descriptor() ([]byte, []int) {
return file_konfa_user_v1_user_proto_rawDescGZIP(), []int{0}
}
func (x *User) GetId() string {
if x != nil {
return x.Id
}
return ""
}
func (x *User) GetUsername() string {
if x != nil {
return x.Username
}
return ""
}
var File_konfa_user_v1_user_proto protoreflect.FileDescriptor
var file_konfa_user_v1_user_proto_rawDesc = []byte{
0x0a, 0x18, 0x6b, 0x6f, 0x6e, 0x66, 0x61, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x2f,
0x75, 0x73, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x6b, 0x6f, 0x6e, 0x66,
0x61, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x22, 0x32, 0x0a, 0x04, 0x55, 0x73, 0x65,
0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69,
0x64, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20,
0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0xb5, 0x01,
0x0a, 0x11, 0x63, 0x6f, 0x6d, 0x2e, 0x6b, 0x6f, 0x6e, 0x66, 0x61, 0x2e, 0x75, 0x73, 0x65, 0x72,
0x2e, 0x76, 0x31, 0x42, 0x09, 0x55, 0x73, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01,
0x5a, 0x3f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x72, 0x6f, 0x79,
0x61, 0x6c, 0x63, 0x61, 0x74, 0x2f, 0x6b, 0x6f, 0x6e, 0x66, 0x61, 0x2d, 0x73, 0x65, 0x72, 0x76,
0x65, 0x72, 0x2f, 0x73, 0x72, 0x63, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6b, 0x6f, 0x6e,
0x66, 0x61, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x3b, 0x75, 0x73, 0x65, 0x72, 0x76,
0x31, 0xa2, 0x02, 0x03, 0x4b, 0x55, 0x58, 0xaa, 0x02, 0x0d, 0x4b, 0x6f, 0x6e, 0x66, 0x61, 0x2e,
0x55, 0x73, 0x65, 0x72, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0d, 0x4b, 0x6f, 0x6e, 0x66, 0x61, 0x5c,
0x55, 0x73, 0x65, 0x72, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x19, 0x4b, 0x6f, 0x6e, 0x66, 0x61, 0x5c,
0x55, 0x73, 0x65, 0x72, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64,
0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x4b, 0x6f, 0x6e, 0x66, 0x61, 0x3a, 0x3a, 0x55, 0x73, 0x65,
0x72, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_konfa_user_v1_user_proto_rawDescOnce sync.Once
file_konfa_user_v1_user_proto_rawDescData = file_konfa_user_v1_user_proto_rawDesc
)
func file_konfa_user_v1_user_proto_rawDescGZIP() []byte {
file_konfa_user_v1_user_proto_rawDescOnce.Do(func() {
file_konfa_user_v1_user_proto_rawDescData = protoimpl.X.CompressGZIP(file_konfa_user_v1_user_proto_rawDescData)
})
return file_konfa_user_v1_user_proto_rawDescData
}
var file_konfa_user_v1_user_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_konfa_user_v1_user_proto_goTypes = []any{
(*User)(nil), // 0: konfa.user.v1.User
}
var file_konfa_user_v1_user_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
0, // [0:0] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_konfa_user_v1_user_proto_init() }
func file_konfa_user_v1_user_proto_init() {
if File_konfa_user_v1_user_proto != nil {
return
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_konfa_user_v1_user_proto_rawDesc,
NumEnums: 0,
NumMessages: 1,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_konfa_user_v1_user_proto_goTypes,
DependencyIndexes: file_konfa_user_v1_user_proto_depIdxs,
MessageInfos: file_konfa_user_v1_user_proto_msgTypes,
}.Build()
File_konfa_user_v1_user_proto = out.File
file_konfa_user_v1_user_proto_rawDesc = nil
file_konfa_user_v1_user_proto_goTypes = nil
file_konfa_user_v1_user_proto_depIdxs = nil
}

View file

@ -3,6 +3,7 @@ package proto
import ( import (
channelv1 "github.com/royalcat/konfa-server/src/proto/konfa/channel/v1" channelv1 "github.com/royalcat/konfa-server/src/proto/konfa/channel/v1"
chatv1 "github.com/royalcat/konfa-server/src/proto/konfa/chat/v1" chatv1 "github.com/royalcat/konfa-server/src/proto/konfa/chat/v1"
userv1 "github.com/royalcat/konfa-server/src/proto/konfa/user/v1"
"github.com/royalcat/konfa-server/src/store" "github.com/royalcat/konfa-server/src/store"
"google.golang.org/protobuf/types/known/timestamppb" "google.golang.org/protobuf/types/known/timestamppb"
) )
@ -47,3 +48,10 @@ func mapVoiceChannel(c store.VoiceChannel) *channelv1.VoiceChannel {
Name: c.Name, Name: c.Name,
} }
} }
func mapUser(c store.User) *userv1.User {
return &userv1.User{
Id: c.ID.String(),
Username: c.Username,
}
}

View file

@ -46,3 +46,37 @@ func (s *ServerService) ListServerChannels(ctx context.Context, req *serverv1.Li
Channels: channels, Channels: channels,
}, nil }, nil
} }
// ListServerUsers implements serverv1.ServerServiceServer.
func (s *ServerService) ListServerUsers(ctx context.Context, req *serverv1.ListServerUsersRequest) (*serverv1.ListServerUsersResponse, error) {
serverID, err := uuid.FromString(req.ServerId)
if err != nil {
return nil, err
}
users, err := s.srv.ListServerUser(ctx, serverID)
if err != nil {
return nil, err
}
return &serverv1.ListServerUsersResponse{
Users: apply(users, mapUser),
}, nil
}
// GetUser implements serverv1.ServerServiceServer.
func (s *ServerService) GetUser(ctx context.Context, req *serverv1.GetUserRequest) (*serverv1.GetUserResponse, error) {
userID, err := uuid.FromString(req.UserId)
if err != nil {
return nil, err
}
users, err := s.srv.GetUser(ctx, userID)
if err != nil {
return nil, err
}
return &serverv1.GetUserResponse{
User: mapUser(users),
}, nil
}