From e81f6059993563ad0e9bb92c92f09e3f3e846e91 Mon Sep 17 00:00:00 2001 From: oneao Date: Tue, 2 Dec 2025 22:44:12 +0800 Subject: [PATCH] u --- .../handler/money/money_category_service.go | 1 + .../biz/handler/space/space_service.go | 89 ++- .../biz/handler/space/space_user_service.go | 207 ++++++ .../base-go-v3/biz/model/api/api.pb.go | 2 +- .../model/money/{index.pb.go => money.pb.go} | 34 +- .../model/money/money_category_types.pb.go | 2 +- .../biz/model/money/money_record_types.pb.go | 2 +- .../base-go-v3/biz/model/space/index.pb.go | 78 -- .../base-go-v3/biz/model/space/space.pb.go | 133 ++++ .../biz/model/space/space_types.pb.go | 192 +---- .../biz/model/space/space_user_types.pb.go | 686 ++++++++++++++++-- .../biz/router/money/{index.go => money.go} | 0 .../base-go-v3/biz/router/space/middleware.go | 35 + .../biz/router/space/{index.go => space.go} | 8 + .../base-go-v3/db/queries/space.sql | 13 - .../base-go-v3/db/queries/space_user.sql | 17 + .../base-go-v3/db/repo/space.sql.go | 48 -- .../base-go-v3/db/repo/space_user.sql.go | 65 ++ code/base-project/base-go-v3/db/schema.sql | 3 + .../idl/money/{index.proto => money.proto} | 0 .../base-go-v3/idl/space/space.proto | 23 +- .../base-go-v3/idl/space/space_types.proto | 13 - .../idl/space/space_user_types.proto | 48 +- 23 files changed, 1286 insertions(+), 413 deletions(-) create mode 100644 code/base-project/base-go-v3/biz/handler/space/space_user_service.go rename code/base-project/base-go-v3/biz/model/money/{index.pb.go => money.pb.go} (93%) delete mode 100644 code/base-project/base-go-v3/biz/model/space/index.pb.go create mode 100644 code/base-project/base-go-v3/biz/model/space/space.pb.go rename code/base-project/base-go-v3/biz/router/money/{index.go => money.go} (100%) rename code/base-project/base-go-v3/biz/router/space/{index.go => space.go} (59%) rename code/base-project/base-go-v3/idl/money/{index.proto => money.proto} (100%) diff --git a/code/base-project/base-go-v3/biz/handler/money/money_category_service.go b/code/base-project/base-go-v3/biz/handler/money/money_category_service.go index 869d646e..a9c6d258 100644 --- a/code/base-project/base-go-v3/biz/handler/money/money_category_service.go +++ b/code/base-project/base-go-v3/biz/handler/money/money_category_service.go @@ -11,6 +11,7 @@ import ( "context" money "cn/oneao/base-go/biz/model/money" + "github.com/cloudwego/hertz/pkg/app" "github.com/cloudwego/hertz/pkg/protocol/consts" ) diff --git a/code/base-project/base-go-v3/biz/handler/space/space_service.go b/code/base-project/base-go-v3/biz/handler/space/space_service.go index faf5216e..720467e7 100644 --- a/code/base-project/base-go-v3/biz/handler/space/space_service.go +++ b/code/base-project/base-go-v3/biz/handler/space/space_service.go @@ -13,6 +13,7 @@ import ( "context" space "cn/oneao/base-go/biz/model/space" + "github.com/cloudwego/hertz/pkg/app" "github.com/cloudwego/hertz/pkg/protocol/consts" ) @@ -73,23 +74,93 @@ func InsertSpace(ctx context.Context, c *app.RequestContext) { // 如果存在,继续循环重新生成 } - // 创建空间 spaceId := idgen.NextId() - params := repo.InsertSpaceParams{ - ID: spaceId, - InviteCode: inviteCode, - } - err = db.Queries.InsertSpace(ctx, params) + err = db.WithTx(ctx, func(q *repo.Queries) error { + // 创建空间 + params := repo.InsertSpaceParams{ + ID: spaceId, + InviteCode: inviteCode, + } + + err = q.InsertSpace(ctx, params) + + if err != nil { + return err + } + // 将创建用户默认添加到该空间内 + userParams := repo.InsertSpaceUserParams{ + ID: idgen.NextId(), + SpaceID: spaceId, + UserID: userID, + Role: 0, + } + err := q.InsertSpaceUser(ctx, userParams) + + if err != nil { + return err + } + + return nil + }) if err != nil { errorx.AddError(c, err) return } - var resp space.InsertSpaceResult - resp.Id = spaceId - resp.InviteCode = inviteCode + resp := &space.InsertSpaceResult{ + Id: spaceId, + InviteCode: inviteCode, + } response.Success(c).Data(resp).Send() } + +// DeleteSpace . +// @router /space/delete [POST] +func DeleteSpace(ctx context.Context, c *app.RequestContext) { + var err error + var req space.DeleteSpaceParams + err = c.BindAndValidate(&req) + if err != nil { + c.String(consts.StatusBadRequest, err.Error()) + return + } + + userID := middleware.GetUserID(ctx) + spaceByUserId, err := db.Queries.GetSpaceByUserId(ctx, userID) + + if err != nil { + if errorx.IsNotFound(err) { + response.Success(c).Send() + return + } else { + errorx.AddError(c, err) + return + } + } + + spaceId := spaceByUserId.ID + + err = db.WithTx(ctx, func(q *repo.Queries) error { + err := q.DeleteSpace(ctx, spaceId) + if err != nil { + return err + } + + err = q.DeleteSpaceUserAll(ctx, spaceId) + if err != nil { + return err + } + + return nil + }) + + if err != nil { + errorx.AddError(c, err) + return + } + + response.Success(c).Send() +} diff --git a/code/base-project/base-go-v3/biz/handler/space/space_user_service.go b/code/base-project/base-go-v3/biz/handler/space/space_user_service.go new file mode 100644 index 00000000..47c0cd56 --- /dev/null +++ b/code/base-project/base-go-v3/biz/handler/space/space_user_service.go @@ -0,0 +1,207 @@ +// Code generated by hertz generator. + +package space + +import ( + space "cn/oneao/base-go/biz/model/space" + "cn/oneao/base-go/biz/router/middleware" + "cn/oneao/base-go/db" + "cn/oneao/base-go/db/repo" + "cn/oneao/base-go/utils/errorx" + "cn/oneao/base-go/utils/response" + "context" + + "github.com/cloudwego/hertz/pkg/app" + "github.com/cloudwego/hertz/pkg/protocol/consts" +) + +// ExitSpace . +// @router /space_user/exit [POST] +func ExitSpace(ctx context.Context, c *app.RequestContext) { + var err error + var req space.ExitSpaceParams + err = c.BindAndValidate(&req) + if err != nil { + c.String(consts.StatusBadRequest, err.Error()) + return + } + + userID := middleware.GetUserID(ctx) + + err = db.Queries.DeleteSpaceUser(ctx, userID) + + if err != nil { + errorx.AddError(c, err) + return + } + + response.Success(c).Send() +} + +// ListSpaceUsers . +// @router /space_user/list [POST] +func ListSpaceUsers(ctx context.Context, c *app.RequestContext) { + var err error + var req space.ListSpaceUsersParams + err = c.BindAndValidate(&req) + if err != nil { + c.String(consts.StatusBadRequest, err.Error()) + return + } + + spaceId := req.SpaceId + + users, err := db.Queries.ListSpaceUsers(ctx, spaceId) + + if err != nil { + errorx.AddError(c, err) + return + } + + resp := &space.ListSpaceUsersResult{} + for _, u := range users { + resp.Users = append(resp.Users, &space.SpaceUser{ + UserId: u.UserID, + Username: u.Username.String, + SpaceRole: u.Role, + }) + } + + response.Success(c).Data(resp).Send() +} + +// RemoveSpaceUser . +// @router /space_user/remove [POST] +func RemoveSpaceUser(ctx context.Context, c *app.RequestContext) { + var req space.RemoveSpaceUserParams + if err := c.BindAndValidate(&req); err != nil { + c.String(consts.StatusBadRequest, err.Error()) + return + } + + spaceId := req.SpaceId + delUserId := req.UserId + userID := middleware.GetUserID(ctx) + + if userID == delUserId { + response.Fail(c).Message("请退出空间或解散空间").Send() + return + } + + // 当前操作者信息 + spaceUser, err := db.Queries.GetSpaceUserByUserId(ctx, userID) + if err != nil { + if errorx.IsNotFound(err) { + response.Fail(c).Message("权限不足").Send() + return + } + errorx.AddError(c, err) + return + } + + if spaceUser.SpaceID != spaceId { + response.Fail(c).Message("权限不足").Send() + return + } + + if spaceUser.Role != 0 && spaceUser.Role != 1 { + response.Fail(c).Message("权限不足").Send() + return + } + + // 被踢用户是否在该空间 + targetUser, err := db.Queries.GetSpaceUserByUserId(ctx, delUserId) + if err != nil { + if errorx.IsNotFound(err) { + response.Success(c).Message("用户不在空间").Send() + return + } + errorx.AddError(c, err) + return + } + + if targetUser.SpaceID != spaceId { + response.Fail(c).Message("用户不在该空间").Send() + return + } + + // 删除 + err = db.Queries.DeleteSpaceUser(ctx, delUserId) + + if err != nil { + errorx.AddError(c, err) + return + } + + response.Success(c).Message("移除成功").Send() +} + +// UpdateSpaceUserRole . +// @router /space_user/updateRole [POST] +func UpdateSpaceUserRole(ctx context.Context, c *app.RequestContext) { + var req space.UpdateSpaceUserRoleParams + if err := c.BindAndValidate(&req); err != nil { + c.String(consts.StatusBadRequest, err.Error()) + return + } + + // 1. 获取当前操作者信息 + userID := middleware.GetUserID(ctx) + operator, err := db.Queries.GetSpaceUserByUserId(ctx, userID) + if err != nil { + if errorx.IsNotFound(err) { + response.Fail(c).Message("权限不足").Send() + return + } + errorx.AddError(c, err) + return + } + + // 2. 检查操作者是否属于该空间 + if operator.SpaceID != req.SpaceId { + response.Fail(c).Message("权限不足").Send() + return + } + + // 3. 权限检查:只有创建者或管理员可以修改他人角色 + // 假设 Role: 0=创建者, 1=管理员, 2=普通成员 + if operator.Role != 0 && operator.Role != 1 { + response.Fail(c).Message("权限不足").Send() + return + } + + // 4. 校验目标 Role 是否合法 + if req.Role != 1 && req.Role != 2 { + response.Fail(c).Message("Role 只能是 1 或 2").Send() + return + } + + // 5. 获取被修改的用户 + targetUser, err := db.Queries.GetSpaceUserByUserId(ctx, req.UserId) + if err != nil { + if errorx.IsNotFound(err) { + response.Fail(c).Message("目标用户不存在").Send() + return + } + errorx.AddError(c, err) + return + } + + if targetUser.SpaceID != req.SpaceId { + response.Fail(c).Message("目标用户不在该空间").Send() + return + } + + // 6. 执行更新 + err = db.Queries.UpdateSpaceUserRole(ctx, repo.UpdateSpaceUserRoleParams{ + SpaceID: req.SpaceId, + UserID: req.UserId, + Role: req.Role, + }) + if err != nil { + errorx.AddError(c, err) + return + } + + response.Success(c).Data().Send() +} diff --git a/code/base-project/base-go-v3/biz/model/api/api.pb.go b/code/base-project/base-go-v3/biz/model/api/api.pb.go index 09470162..37434df6 100644 --- a/code/base-project/base-go-v3/biz/model/api/api.pb.go +++ b/code/base-project/base-go-v3/biz/model/api/api.pb.go @@ -3,7 +3,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.0 -// protoc v4.25.3 +// protoc v6.33.1 // source: api.proto package api diff --git a/code/base-project/base-go-v3/biz/model/money/index.pb.go b/code/base-project/base-go-v3/biz/model/money/money.pb.go similarity index 93% rename from code/base-project/base-go-v3/biz/model/money/index.pb.go rename to code/base-project/base-go-v3/biz/model/money/money.pb.go index 79bbdc85..6beae543 100644 --- a/code/base-project/base-go-v3/biz/model/money/index.pb.go +++ b/code/base-project/base-go-v3/biz/model/money/money.pb.go @@ -1,8 +1,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.0 -// protoc v4.25.3 -// source: index.proto +// protoc v6.33.1 +// source: money.proto package money @@ -20,10 +20,10 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -var File_index_proto protoreflect.FileDescriptor +var File_money_proto protoreflect.FileDescriptor -var file_index_proto_rawDesc = []byte{ - 0x0a, 0x0b, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x6d, +var file_money_proto_rawDesc = []byte{ + 0x0a, 0x0b, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x1a, 0x09, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x2f, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x5f, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, @@ -87,7 +87,7 @@ var file_index_proto_rawDesc = []byte{ 0x6f, 0x6e, 0x65, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } -var file_index_proto_goTypes = []interface{}{ +var file_money_proto_goTypes = []interface{}{ (*QueryMoneyCategoryReq)(nil), // 0: money.QueryMoneyCategoryReq (*DeleteMoneyCategoryReq)(nil), // 1: money.DeleteMoneyCategoryReq (*UpdateMoneyCategorySortReq)(nil), // 2: money.UpdateMoneyCategorySortReq @@ -103,7 +103,7 @@ var file_index_proto_goTypes = []interface{}{ (*UpdateMoneyRecordResult)(nil), // 12: money.UpdateMoneyRecordResult (*DeleteMoneyRecordResult)(nil), // 13: money.DeleteMoneyRecordResult } -var file_index_proto_depIdxs = []int32{ +var file_money_proto_depIdxs = []int32{ 0, // 0: money.MoneyCategoryService.QueryUserMoneyCategory:input_type -> money.QueryMoneyCategoryReq 1, // 1: money.MoneyCategoryService.DeleteUserMoneyCategory:input_type -> money.DeleteMoneyCategoryReq 2, // 2: money.MoneyCategoryService.UpdateMoneyCategorySort:input_type -> money.UpdateMoneyCategorySortReq @@ -125,9 +125,9 @@ var file_index_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for field type_name } -func init() { file_index_proto_init() } -func file_index_proto_init() { - if File_index_proto != nil { +func init() { file_money_proto_init() } +func file_money_proto_init() { + if File_money_proto != nil { return } file_money_money_category_types_proto_init() @@ -136,17 +136,17 @@ func file_index_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_index_proto_rawDesc, + RawDescriptor: file_money_proto_rawDesc, NumEnums: 0, NumMessages: 0, NumExtensions: 0, NumServices: 2, }, - GoTypes: file_index_proto_goTypes, - DependencyIndexes: file_index_proto_depIdxs, + GoTypes: file_money_proto_goTypes, + DependencyIndexes: file_money_proto_depIdxs, }.Build() - File_index_proto = out.File - file_index_proto_rawDesc = nil - file_index_proto_goTypes = nil - file_index_proto_depIdxs = nil + File_money_proto = out.File + file_money_proto_rawDesc = nil + file_money_proto_goTypes = nil + file_money_proto_depIdxs = nil } diff --git a/code/base-project/base-go-v3/biz/model/money/money_category_types.pb.go b/code/base-project/base-go-v3/biz/model/money/money_category_types.pb.go index 8505dc57..154eb7e1 100644 --- a/code/base-project/base-go-v3/biz/model/money/money_category_types.pb.go +++ b/code/base-project/base-go-v3/biz/model/money/money_category_types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.0 -// protoc v4.25.3 +// protoc v6.33.1 // source: money/money_category_types.proto package money diff --git a/code/base-project/base-go-v3/biz/model/money/money_record_types.pb.go b/code/base-project/base-go-v3/biz/model/money/money_record_types.pb.go index 910a26b5..0d79e677 100644 --- a/code/base-project/base-go-v3/biz/model/money/money_record_types.pb.go +++ b/code/base-project/base-go-v3/biz/model/money/money_record_types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.0 -// protoc v4.25.3 +// protoc v6.33.1 // source: money/money_record_types.proto package money diff --git a/code/base-project/base-go-v3/biz/model/space/index.pb.go b/code/base-project/base-go-v3/biz/model/space/index.pb.go deleted file mode 100644 index c75022cd..00000000 --- a/code/base-project/base-go-v3/biz/model/space/index.pb.go +++ /dev/null @@ -1,78 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.28.0 -// protoc v4.25.3 -// source: index.proto - -package space - -import ( - _ "cn/oneao/base-go/biz/model/api" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" -) - -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) -) - -var File_index_proto protoreflect.FileDescriptor - -var file_index_proto_rawDesc = []byte{ - 0x0a, 0x0b, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x73, - 0x70, 0x61, 0x63, 0x65, 0x1a, 0x09, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, - 0x17, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x74, 0x79, 0x70, - 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x64, 0x0a, 0x0c, 0x53, 0x70, 0x61, 0x63, - 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x54, 0x0a, 0x0b, 0x49, 0x6e, 0x73, 0x65, - 0x72, 0x74, 0x53, 0x70, 0x61, 0x63, 0x65, 0x12, 0x18, 0x2e, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, - 0x49, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x53, 0x70, 0x61, 0x63, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x73, 0x1a, 0x18, 0x2e, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, 0x49, 0x6e, 0x73, 0x65, 0x72, 0x74, - 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x11, 0xd2, 0xc1, 0x18, - 0x0d, 0x2f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2f, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x42, 0x22, - 0x5a, 0x20, 0x63, 0x6e, 0x2f, 0x6f, 0x6e, 0x65, 0x61, 0x6f, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2d, - 0x67, 0x6f, 0x2f, 0x62, 0x69, 0x7a, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2f, 0x73, 0x70, 0x61, - 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var file_index_proto_goTypes = []interface{}{ - (*InsertSpaceParams)(nil), // 0: space.InsertSpaceParams - (*InsertSpaceResult)(nil), // 1: space.InsertSpaceResult -} -var file_index_proto_depIdxs = []int32{ - 0, // 0: space.SpaceService.InsertSpace:input_type -> space.InsertSpaceParams - 1, // 1: space.SpaceService.InsertSpace:output_type -> space.InsertSpaceResult - 1, // [1:2] is the sub-list for method output_type - 0, // [0:1] 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_index_proto_init() } -func file_index_proto_init() { - if File_index_proto != nil { - return - } - file_space_space_types_proto_init() - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_index_proto_rawDesc, - NumEnums: 0, - NumMessages: 0, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_index_proto_goTypes, - DependencyIndexes: file_index_proto_depIdxs, - }.Build() - File_index_proto = out.File - file_index_proto_rawDesc = nil - file_index_proto_goTypes = nil - file_index_proto_depIdxs = nil -} diff --git a/code/base-project/base-go-v3/biz/model/space/space.pb.go b/code/base-project/base-go-v3/biz/model/space/space.pb.go new file mode 100644 index 00000000..a16473c0 --- /dev/null +++ b/code/base-project/base-go-v3/biz/model/space/space.pb.go @@ -0,0 +1,133 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.0 +// protoc v6.33.1 +// source: space.proto + +package space + +import ( + _ "cn/oneao/base-go/biz/model/api" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" +) + +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) +) + +var File_space_proto protoreflect.FileDescriptor + +var file_space_proto_rawDesc = []byte{ + 0x0a, 0x0b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x73, + 0x70, 0x61, 0x63, 0x65, 0x1a, 0x09, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, + 0x17, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x74, 0x79, 0x70, + 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2f, + 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x73, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0xba, 0x01, 0x0a, 0x0c, 0x53, 0x70, 0x61, 0x63, 0x65, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x54, 0x0a, 0x0b, 0x49, 0x6e, 0x73, 0x65, 0x72, + 0x74, 0x53, 0x70, 0x61, 0x63, 0x65, 0x12, 0x18, 0x2e, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, 0x49, + 0x6e, 0x73, 0x65, 0x72, 0x74, 0x53, 0x70, 0x61, 0x63, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x1a, 0x18, 0x2e, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, 0x49, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x53, + 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x11, 0xd2, 0xc1, 0x18, 0x0d, + 0x2f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2f, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x12, 0x54, 0x0a, + 0x0b, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x70, 0x61, 0x63, 0x65, 0x12, 0x18, 0x2e, 0x73, + 0x70, 0x61, 0x63, 0x65, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x70, 0x61, 0x63, 0x65, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x18, 0x2e, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, 0x44, + 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, + 0x22, 0x11, 0xd2, 0xc1, 0x18, 0x0d, 0x2f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2f, 0x64, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x32, 0xa5, 0x03, 0x0a, 0x10, 0x53, 0x70, 0x61, 0x63, 0x65, 0x55, 0x73, 0x65, + 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x51, 0x0a, 0x09, 0x45, 0x78, 0x69, 0x74, + 0x53, 0x70, 0x61, 0x63, 0x65, 0x12, 0x16, 0x2e, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, 0x45, 0x78, + 0x69, 0x74, 0x53, 0x70, 0x61, 0x63, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x16, 0x2e, + 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, 0x45, 0x78, 0x69, 0x74, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, + 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x14, 0xd2, 0xc1, 0x18, 0x10, 0x2f, 0x73, 0x70, 0x61, 0x63, + 0x65, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x65, 0x78, 0x69, 0x74, 0x12, 0x60, 0x0a, 0x0e, 0x4c, + 0x69, 0x73, 0x74, 0x53, 0x70, 0x61, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x73, 0x12, 0x1b, 0x2e, + 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x70, 0x61, 0x63, 0x65, 0x55, + 0x73, 0x65, 0x72, 0x73, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x1b, 0x2e, 0x73, 0x70, 0x61, + 0x63, 0x65, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x70, 0x61, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, + 0x73, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x14, 0xd2, 0xc1, 0x18, 0x10, 0x2f, 0x73, 0x70, + 0x61, 0x63, 0x65, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x6c, 0x69, 0x73, 0x74, 0x12, 0x65, 0x0a, + 0x0f, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, 0x70, 0x61, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, + 0x12, 0x1c, 0x2e, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, + 0x70, 0x61, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x1c, + 0x2e, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, 0x70, 0x61, + 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x16, 0xd2, 0xc1, + 0x18, 0x12, 0x2f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x72, 0x65, + 0x6d, 0x6f, 0x76, 0x65, 0x12, 0x75, 0x0a, 0x13, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x70, + 0x61, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x6f, 0x6c, 0x65, 0x12, 0x20, 0x2e, 0x73, 0x70, + 0x61, 0x63, 0x65, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x70, 0x61, 0x63, 0x65, 0x55, + 0x73, 0x65, 0x72, 0x52, 0x6f, 0x6c, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x20, 0x2e, + 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x70, 0x61, 0x63, + 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, + 0x1a, 0xd2, 0xc1, 0x18, 0x16, 0x2f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x75, 0x73, 0x65, 0x72, + 0x2f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x6f, 0x6c, 0x65, 0x42, 0x22, 0x5a, 0x20, 0x63, + 0x6e, 0x2f, 0x6f, 0x6e, 0x65, 0x61, 0x6f, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2d, 0x67, 0x6f, 0x2f, + 0x62, 0x69, 0x7a, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var file_space_proto_goTypes = []interface{}{ + (*InsertSpaceParams)(nil), // 0: space.InsertSpaceParams + (*DeleteSpaceParams)(nil), // 1: space.DeleteSpaceParams + (*ExitSpaceParams)(nil), // 2: space.ExitSpaceParams + (*ListSpaceUsersParams)(nil), // 3: space.ListSpaceUsersParams + (*RemoveSpaceUserParams)(nil), // 4: space.RemoveSpaceUserParams + (*UpdateSpaceUserRoleParams)(nil), // 5: space.UpdateSpaceUserRoleParams + (*InsertSpaceResult)(nil), // 6: space.InsertSpaceResult + (*DeleteSpaceResult)(nil), // 7: space.DeleteSpaceResult + (*ExitSpaceResult)(nil), // 8: space.ExitSpaceResult + (*ListSpaceUsersResult)(nil), // 9: space.ListSpaceUsersResult + (*RemoveSpaceUserResult)(nil), // 10: space.RemoveSpaceUserResult + (*UpdateSpaceUserRoleResult)(nil), // 11: space.UpdateSpaceUserRoleResult +} +var file_space_proto_depIdxs = []int32{ + 0, // 0: space.SpaceService.InsertSpace:input_type -> space.InsertSpaceParams + 1, // 1: space.SpaceService.DeleteSpace:input_type -> space.DeleteSpaceParams + 2, // 2: space.SpaceUserService.ExitSpace:input_type -> space.ExitSpaceParams + 3, // 3: space.SpaceUserService.ListSpaceUsers:input_type -> space.ListSpaceUsersParams + 4, // 4: space.SpaceUserService.RemoveSpaceUser:input_type -> space.RemoveSpaceUserParams + 5, // 5: space.SpaceUserService.UpdateSpaceUserRole:input_type -> space.UpdateSpaceUserRoleParams + 6, // 6: space.SpaceService.InsertSpace:output_type -> space.InsertSpaceResult + 7, // 7: space.SpaceService.DeleteSpace:output_type -> space.DeleteSpaceResult + 8, // 8: space.SpaceUserService.ExitSpace:output_type -> space.ExitSpaceResult + 9, // 9: space.SpaceUserService.ListSpaceUsers:output_type -> space.ListSpaceUsersResult + 10, // 10: space.SpaceUserService.RemoveSpaceUser:output_type -> space.RemoveSpaceUserResult + 11, // 11: space.SpaceUserService.UpdateSpaceUserRole:output_type -> space.UpdateSpaceUserRoleResult + 6, // [6:12] is the sub-list for method output_type + 0, // [0:6] 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_space_proto_init() } +func file_space_proto_init() { + if File_space_proto != nil { + return + } + file_space_space_types_proto_init() + file_space_space_user_types_proto_init() + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_space_proto_rawDesc, + NumEnums: 0, + NumMessages: 0, + NumExtensions: 0, + NumServices: 2, + }, + GoTypes: file_space_proto_goTypes, + DependencyIndexes: file_space_proto_depIdxs, + }.Build() + File_space_proto = out.File + file_space_proto_rawDesc = nil + file_space_proto_goTypes = nil + file_space_proto_depIdxs = nil +} diff --git a/code/base-project/base-go-v3/biz/model/space/space_types.pb.go b/code/base-project/base-go-v3/biz/model/space/space_types.pb.go index 199c8f18..8ba64b1d 100644 --- a/code/base-project/base-go-v3/biz/model/space/space_types.pb.go +++ b/code/base-project/base-go-v3/biz/model/space/space_types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.0 -// protoc v4.25.3 +// protoc v6.33.1 // source: space/space_types.proto package space @@ -192,130 +192,6 @@ func (*DeleteSpaceResult) Descriptor() ([]byte, []int) { return file_space_space_types_proto_rawDescGZIP(), []int{3} } -// 获取空间下的所有用户 -type QuerySpaceUsersParams struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - SpaceId int64 `protobuf:"varint,1,opt,name=SpaceId,proto3" form:"space_id" json:"space_id" vd:"$ != 0"` -} - -func (x *QuerySpaceUsersParams) Reset() { - *x = QuerySpaceUsersParams{} - if protoimpl.UnsafeEnabled { - mi := &file_space_space_types_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *QuerySpaceUsersParams) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*QuerySpaceUsersParams) ProtoMessage() {} - -func (x *QuerySpaceUsersParams) ProtoReflect() protoreflect.Message { - mi := &file_space_space_types_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use QuerySpaceUsersParams.ProtoReflect.Descriptor instead. -func (*QuerySpaceUsersParams) Descriptor() ([]byte, []int) { - return file_space_space_types_proto_rawDescGZIP(), []int{4} -} - -func (x *QuerySpaceUsersParams) GetSpaceId() int64 { - if x != nil { - return x.SpaceId - } - return 0 -} - -type SpaceUser struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *SpaceUser) Reset() { - *x = SpaceUser{} - if protoimpl.UnsafeEnabled { - mi := &file_space_space_types_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SpaceUser) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SpaceUser) ProtoMessage() {} - -func (x *SpaceUser) ProtoReflect() protoreflect.Message { - mi := &file_space_space_types_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SpaceUser.ProtoReflect.Descriptor instead. -func (*SpaceUser) Descriptor() ([]byte, []int) { - return file_space_space_types_proto_rawDescGZIP(), []int{5} -} - -type QuerySpaceUsersResult struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *QuerySpaceUsersResult) Reset() { - *x = QuerySpaceUsersResult{} - if protoimpl.UnsafeEnabled { - mi := &file_space_space_types_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *QuerySpaceUsersResult) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*QuerySpaceUsersResult) ProtoMessage() {} - -func (x *QuerySpaceUsersResult) ProtoReflect() protoreflect.Message { - mi := &file_space_space_types_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use QuerySpaceUsersResult.ProtoReflect.Descriptor instead. -func (*QuerySpaceUsersResult) Descriptor() ([]byte, []int) { - return file_space_space_types_proto_rawDescGZIP(), []int{6} -} - var File_space_space_types_proto protoreflect.FileDescriptor var file_space_space_types_proto_rawDesc = []byte{ @@ -331,17 +207,10 @@ var file_space_space_types_proto_rawDesc = []byte{ 0x64, 0x65, 0x52, 0x0a, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x22, 0x13, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x70, 0x61, 0x63, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x13, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x70, 0x61, - 0x63, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x49, 0x0a, 0x15, 0x51, 0x75, 0x65, 0x72, - 0x79, 0x53, 0x70, 0x61, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x73, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x73, 0x12, 0x30, 0x0a, 0x07, 0x53, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x03, 0x42, 0x16, 0xca, 0xbb, 0x18, 0x08, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, - 0xda, 0xbb, 0x18, 0x06, 0x24, 0x20, 0x21, 0x3d, 0x20, 0x30, 0x52, 0x07, 0x53, 0x70, 0x61, 0x63, - 0x65, 0x49, 0x64, 0x22, 0x0b, 0x0a, 0x09, 0x53, 0x70, 0x61, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, - 0x22, 0x17, 0x0a, 0x15, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x70, 0x61, 0x63, 0x65, 0x55, 0x73, - 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x42, 0x22, 0x5a, 0x20, 0x63, 0x6e, 0x2f, - 0x6f, 0x6e, 0x65, 0x61, 0x6f, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2d, 0x67, 0x6f, 0x2f, 0x62, 0x69, - 0x7a, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x63, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x42, 0x22, 0x5a, 0x20, 0x63, 0x6e, 0x2f, 0x6f, + 0x6e, 0x65, 0x61, 0x6f, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2d, 0x67, 0x6f, 0x2f, 0x62, 0x69, 0x7a, + 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -356,15 +225,12 @@ func file_space_space_types_proto_rawDescGZIP() []byte { return file_space_space_types_proto_rawDescData } -var file_space_space_types_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_space_space_types_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_space_space_types_proto_goTypes = []interface{}{ - (*InsertSpaceParams)(nil), // 0: space.InsertSpaceParams - (*InsertSpaceResult)(nil), // 1: space.InsertSpaceResult - (*DeleteSpaceParams)(nil), // 2: space.DeleteSpaceParams - (*DeleteSpaceResult)(nil), // 3: space.DeleteSpaceResult - (*QuerySpaceUsersParams)(nil), // 4: space.QuerySpaceUsersParams - (*SpaceUser)(nil), // 5: space.SpaceUser - (*QuerySpaceUsersResult)(nil), // 6: space.QuerySpaceUsersResult + (*InsertSpaceParams)(nil), // 0: space.InsertSpaceParams + (*InsertSpaceResult)(nil), // 1: space.InsertSpaceResult + (*DeleteSpaceParams)(nil), // 2: space.DeleteSpaceParams + (*DeleteSpaceResult)(nil), // 3: space.DeleteSpaceResult } var file_space_space_types_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for method output_type @@ -428,42 +294,6 @@ func file_space_space_types_proto_init() { return nil } } - file_space_space_types_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QuerySpaceUsersParams); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_space_space_types_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SpaceUser); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_space_space_types_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QuerySpaceUsersResult); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } } type x struct{} out := protoimpl.TypeBuilder{ @@ -471,7 +301,7 @@ func file_space_space_types_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_space_space_types_proto_rawDesc, NumEnums: 0, - NumMessages: 7, + NumMessages: 4, NumExtensions: 0, NumServices: 0, }, diff --git a/code/base-project/base-go-v3/biz/model/space/space_user_types.pb.go b/code/base-project/base-go-v3/biz/model/space/space_user_types.pb.go index 1d70eb53..f5f613c7 100644 --- a/code/base-project/base-go-v3/biz/model/space/space_user_types.pb.go +++ b/code/base-project/base-go-v3/biz/model/space/space_user_types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.0 -// protoc v4.25.3 +// protoc v6.33.1 // source: space/space_user_types.proto package space @@ -21,17 +21,17 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// 加入空间 -type InsertSpaceUserParams struct { +// 获取空间下的成员 +type ListSpaceUsersParams struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - InviteCode int64 `protobuf:"varint,1,opt,name=InviteCode,proto3" form:"invite_code" json:"invite_code"` // 邀请码 + SpaceId int64 `protobuf:"varint,1,opt,name=SpaceId,proto3" form:"space_id" json:"space_id" vd:"$ != 0"` } -func (x *InsertSpaceUserParams) Reset() { - *x = InsertSpaceUserParams{} +func (x *ListSpaceUsersParams) Reset() { + *x = ListSpaceUsersParams{} if protoimpl.UnsafeEnabled { mi := &file_space_space_user_types_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -39,13 +39,13 @@ func (x *InsertSpaceUserParams) Reset() { } } -func (x *InsertSpaceUserParams) String() string { +func (x *ListSpaceUsersParams) String() string { return protoimpl.X.MessageStringOf(x) } -func (*InsertSpaceUserParams) ProtoMessage() {} +func (*ListSpaceUsersParams) ProtoMessage() {} -func (x *InsertSpaceUserParams) ProtoReflect() protoreflect.Message { +func (x *ListSpaceUsersParams) ProtoReflect() protoreflect.Message { mi := &file_space_space_user_types_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -57,29 +57,30 @@ func (x *InsertSpaceUserParams) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use InsertSpaceUserParams.ProtoReflect.Descriptor instead. -func (*InsertSpaceUserParams) Descriptor() ([]byte, []int) { +// Deprecated: Use ListSpaceUsersParams.ProtoReflect.Descriptor instead. +func (*ListSpaceUsersParams) Descriptor() ([]byte, []int) { return file_space_space_user_types_proto_rawDescGZIP(), []int{0} } -func (x *InsertSpaceUserParams) GetInviteCode() int64 { +func (x *ListSpaceUsersParams) GetSpaceId() int64 { if x != nil { - return x.InviteCode + return x.SpaceId } return 0 } -type InsertSpaceUserResult struct { +type SpaceUser struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - SpaceId int64 `protobuf:"varint,1,opt,name=SpaceId,proto3" form:"space_id" json:"space_id"` - InviteCode string `protobuf:"bytes,2,opt,name=InviteCode,proto3" form:"invite_code" json:"invite_code"` + UserId int64 `protobuf:"varint,1,opt,name=UserId,proto3" form:"user_id" json:"user_id"` + Username string `protobuf:"bytes,2,opt,name=Username,proto3" form:"username" json:"username"` + SpaceRole int32 `protobuf:"varint,4,opt,name=SpaceRole,proto3" form:"space_role" json:"space_role"` } -func (x *InsertSpaceUserResult) Reset() { - *x = InsertSpaceUserResult{} +func (x *SpaceUser) Reset() { + *x = SpaceUser{} if protoimpl.UnsafeEnabled { mi := &file_space_space_user_types_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -87,13 +88,13 @@ func (x *InsertSpaceUserResult) Reset() { } } -func (x *InsertSpaceUserResult) String() string { +func (x *SpaceUser) String() string { return protoimpl.X.MessageStringOf(x) } -func (*InsertSpaceUserResult) ProtoMessage() {} +func (*SpaceUser) ProtoMessage() {} -func (x *InsertSpaceUserResult) ProtoReflect() protoreflect.Message { +func (x *SpaceUser) ProtoReflect() protoreflect.Message { mi := &file_space_space_user_types_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -105,43 +106,514 @@ func (x *InsertSpaceUserResult) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use InsertSpaceUserResult.ProtoReflect.Descriptor instead. -func (*InsertSpaceUserResult) Descriptor() ([]byte, []int) { +// Deprecated: Use SpaceUser.ProtoReflect.Descriptor instead. +func (*SpaceUser) Descriptor() ([]byte, []int) { return file_space_space_user_types_proto_rawDescGZIP(), []int{1} } -func (x *InsertSpaceUserResult) GetSpaceId() int64 { +func (x *SpaceUser) GetUserId() int64 { + if x != nil { + return x.UserId + } + return 0 +} + +func (x *SpaceUser) GetUsername() string { + if x != nil { + return x.Username + } + return "" +} + +func (x *SpaceUser) GetSpaceRole() int32 { + if x != nil { + return x.SpaceRole + } + return 0 +} + +type ListSpaceUsersResult struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Users []*SpaceUser `protobuf:"bytes,1,rep,name=users,proto3" form:"users" json:"users" query:"users"` +} + +func (x *ListSpaceUsersResult) Reset() { + *x = ListSpaceUsersResult{} + if protoimpl.UnsafeEnabled { + mi := &file_space_space_user_types_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListSpaceUsersResult) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListSpaceUsersResult) ProtoMessage() {} + +func (x *ListSpaceUsersResult) ProtoReflect() protoreflect.Message { + mi := &file_space_space_user_types_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListSpaceUsersResult.ProtoReflect.Descriptor instead. +func (*ListSpaceUsersResult) Descriptor() ([]byte, []int) { + return file_space_space_user_types_proto_rawDescGZIP(), []int{2} +} + +func (x *ListSpaceUsersResult) GetUsers() []*SpaceUser { + if x != nil { + return x.Users + } + return nil +} + +// 加入空间 +type JoinSpaceParams struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + InviteCode int64 `protobuf:"varint,1,opt,name=InviteCode,proto3" form:"invite_code" json:"invite_code"` // 邀请码 +} + +func (x *JoinSpaceParams) Reset() { + *x = JoinSpaceParams{} + if protoimpl.UnsafeEnabled { + mi := &file_space_space_user_types_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *JoinSpaceParams) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*JoinSpaceParams) ProtoMessage() {} + +func (x *JoinSpaceParams) ProtoReflect() protoreflect.Message { + mi := &file_space_space_user_types_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use JoinSpaceParams.ProtoReflect.Descriptor instead. +func (*JoinSpaceParams) Descriptor() ([]byte, []int) { + return file_space_space_user_types_proto_rawDescGZIP(), []int{3} +} + +func (x *JoinSpaceParams) GetInviteCode() int64 { + if x != nil { + return x.InviteCode + } + return 0 +} + +type JoinSpaceResult struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SpaceId int64 `protobuf:"varint,1,opt,name=SpaceId,proto3" form:"space_id" json:"space_id"` + InviteCode string `protobuf:"bytes,2,opt,name=InviteCode,proto3" form:"invite_code" json:"invite_code"` +} + +func (x *JoinSpaceResult) Reset() { + *x = JoinSpaceResult{} + if protoimpl.UnsafeEnabled { + mi := &file_space_space_user_types_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *JoinSpaceResult) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*JoinSpaceResult) ProtoMessage() {} + +func (x *JoinSpaceResult) ProtoReflect() protoreflect.Message { + mi := &file_space_space_user_types_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use JoinSpaceResult.ProtoReflect.Descriptor instead. +func (*JoinSpaceResult) Descriptor() ([]byte, []int) { + return file_space_space_user_types_proto_rawDescGZIP(), []int{4} +} + +func (x *JoinSpaceResult) GetSpaceId() int64 { if x != nil { return x.SpaceId } return 0 } -func (x *InsertSpaceUserResult) GetInviteCode() string { +func (x *JoinSpaceResult) GetInviteCode() string { if x != nil { return x.InviteCode } return "" } +// 退出空间 +type ExitSpaceParams struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *ExitSpaceParams) Reset() { + *x = ExitSpaceParams{} + if protoimpl.UnsafeEnabled { + mi := &file_space_space_user_types_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ExitSpaceParams) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ExitSpaceParams) ProtoMessage() {} + +func (x *ExitSpaceParams) ProtoReflect() protoreflect.Message { + mi := &file_space_space_user_types_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ExitSpaceParams.ProtoReflect.Descriptor instead. +func (*ExitSpaceParams) Descriptor() ([]byte, []int) { + return file_space_space_user_types_proto_rawDescGZIP(), []int{5} +} + +type ExitSpaceResult struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *ExitSpaceResult) Reset() { + *x = ExitSpaceResult{} + if protoimpl.UnsafeEnabled { + mi := &file_space_space_user_types_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ExitSpaceResult) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ExitSpaceResult) ProtoMessage() {} + +func (x *ExitSpaceResult) ProtoReflect() protoreflect.Message { + mi := &file_space_space_user_types_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ExitSpaceResult.ProtoReflect.Descriptor instead. +func (*ExitSpaceResult) Descriptor() ([]byte, []int) { + return file_space_space_user_types_proto_rawDescGZIP(), []int{6} +} + +// 踢出成员 +type RemoveSpaceUserParams struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SpaceId int64 `protobuf:"varint,1,opt,name=SpaceId,proto3" form:"space_id" json:"space_id" vd:"$ != 0"` + UserId int64 `protobuf:"varint,2,opt,name=UserId,proto3" form:"user_id" json:"user_id" vd:"$ != 0"` +} + +func (x *RemoveSpaceUserParams) Reset() { + *x = RemoveSpaceUserParams{} + if protoimpl.UnsafeEnabled { + mi := &file_space_space_user_types_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RemoveSpaceUserParams) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RemoveSpaceUserParams) ProtoMessage() {} + +func (x *RemoveSpaceUserParams) ProtoReflect() protoreflect.Message { + mi := &file_space_space_user_types_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RemoveSpaceUserParams.ProtoReflect.Descriptor instead. +func (*RemoveSpaceUserParams) Descriptor() ([]byte, []int) { + return file_space_space_user_types_proto_rawDescGZIP(), []int{7} +} + +func (x *RemoveSpaceUserParams) GetSpaceId() int64 { + if x != nil { + return x.SpaceId + } + return 0 +} + +func (x *RemoveSpaceUserParams) GetUserId() int64 { + if x != nil { + return x.UserId + } + return 0 +} + +type RemoveSpaceUserResult struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *RemoveSpaceUserResult) Reset() { + *x = RemoveSpaceUserResult{} + if protoimpl.UnsafeEnabled { + mi := &file_space_space_user_types_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RemoveSpaceUserResult) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RemoveSpaceUserResult) ProtoMessage() {} + +func (x *RemoveSpaceUserResult) ProtoReflect() protoreflect.Message { + mi := &file_space_space_user_types_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RemoveSpaceUserResult.ProtoReflect.Descriptor instead. +func (*RemoveSpaceUserResult) Descriptor() ([]byte, []int) { + return file_space_space_user_types_proto_rawDescGZIP(), []int{8} +} + +// 更新用户权限 +type UpdateSpaceUserRoleParams struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SpaceId int64 `protobuf:"varint,1,opt,name=SpaceId,proto3" form:"space_id" json:"space_id" vd:"$ != 0"` + UserId int64 `protobuf:"varint,2,opt,name=UserId,proto3" form:"user_id" json:"user_id" vd:"$ != 0"` + Role int32 `protobuf:"varint,3,opt,name=Role,proto3" form:"role" json:"role" vd:"$ == 1 || $ == 2"` +} + +func (x *UpdateSpaceUserRoleParams) Reset() { + *x = UpdateSpaceUserRoleParams{} + if protoimpl.UnsafeEnabled { + mi := &file_space_space_user_types_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateSpaceUserRoleParams) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateSpaceUserRoleParams) ProtoMessage() {} + +func (x *UpdateSpaceUserRoleParams) ProtoReflect() protoreflect.Message { + mi := &file_space_space_user_types_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateSpaceUserRoleParams.ProtoReflect.Descriptor instead. +func (*UpdateSpaceUserRoleParams) Descriptor() ([]byte, []int) { + return file_space_space_user_types_proto_rawDescGZIP(), []int{9} +} + +func (x *UpdateSpaceUserRoleParams) GetSpaceId() int64 { + if x != nil { + return x.SpaceId + } + return 0 +} + +func (x *UpdateSpaceUserRoleParams) GetUserId() int64 { + if x != nil { + return x.UserId + } + return 0 +} + +func (x *UpdateSpaceUserRoleParams) GetRole() int32 { + if x != nil { + return x.Role + } + return 0 +} + +type UpdateSpaceUserRoleResult struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *UpdateSpaceUserRoleResult) Reset() { + *x = UpdateSpaceUserRoleResult{} + if protoimpl.UnsafeEnabled { + mi := &file_space_space_user_types_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateSpaceUserRoleResult) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateSpaceUserRoleResult) ProtoMessage() {} + +func (x *UpdateSpaceUserRoleResult) ProtoReflect() protoreflect.Message { + mi := &file_space_space_user_types_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateSpaceUserRoleResult.ProtoReflect.Descriptor instead. +func (*UpdateSpaceUserRoleResult) Descriptor() ([]byte, []int) { + return file_space_space_user_types_proto_rawDescGZIP(), []int{10} +} + var File_space_space_user_types_proto protoreflect.FileDescriptor var file_space_space_user_types_proto_rawDesc = []byte{ 0x0a, 0x1c, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x73, 0x70, 0x61, 0x63, 0x65, 0x1a, 0x09, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x22, 0x48, 0x0a, 0x15, 0x49, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x53, 0x70, 0x61, 0x63, 0x65, 0x55, - 0x73, 0x65, 0x72, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x2f, 0x0a, 0x0a, 0x49, 0x6e, 0x76, - 0x69, 0x74, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x0f, 0xca, - 0xbb, 0x18, 0x0b, 0x69, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x52, 0x0a, - 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x22, 0x70, 0x0a, 0x15, 0x49, 0x6e, - 0x73, 0x65, 0x72, 0x74, 0x53, 0x70, 0x61, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, - 0x75, 0x6c, 0x74, 0x12, 0x26, 0x0a, 0x07, 0x53, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x03, 0x42, 0x0c, 0xca, 0xbb, 0x18, 0x08, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, - 0x69, 0x64, 0x52, 0x07, 0x53, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x12, 0x2f, 0x0a, 0x0a, 0x49, - 0x6e, 0x76, 0x69, 0x74, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, - 0x0f, 0xca, 0xbb, 0x18, 0x0b, 0x69, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x5f, 0x63, 0x6f, 0x64, 0x65, - 0x52, 0x0a, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x42, 0x22, 0x5a, 0x20, + 0x22, 0x48, 0x0a, 0x14, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x70, 0x61, 0x63, 0x65, 0x55, 0x73, 0x65, + 0x72, 0x73, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x30, 0x0a, 0x07, 0x53, 0x70, 0x61, 0x63, + 0x65, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x16, 0xca, 0xbb, 0x18, 0x08, 0x73, + 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0xda, 0xbb, 0x18, 0x06, 0x24, 0x20, 0x21, 0x3d, 0x20, + 0x30, 0x52, 0x07, 0x53, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x22, 0x88, 0x01, 0x0a, 0x09, 0x53, + 0x70, 0x61, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12, 0x23, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, + 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x0b, 0xca, 0xbb, 0x18, 0x07, 0x75, 0x73, + 0x65, 0x72, 0x5f, 0x69, 0x64, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x28, 0x0a, + 0x08, 0x55, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x0c, 0xca, 0xbb, 0x18, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x52, 0x08, 0x55, + 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2c, 0x0a, 0x09, 0x53, 0x70, 0x61, 0x63, 0x65, + 0x52, 0x6f, 0x6c, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x42, 0x0e, 0xca, 0xbb, 0x18, 0x0a, + 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x72, 0x6f, 0x6c, 0x65, 0x52, 0x09, 0x53, 0x70, 0x61, 0x63, + 0x65, 0x52, 0x6f, 0x6c, 0x65, 0x22, 0x3e, 0x0a, 0x14, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x70, 0x61, + 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x26, 0x0a, + 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x73, + 0x70, 0x61, 0x63, 0x65, 0x2e, 0x53, 0x70, 0x61, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x05, + 0x75, 0x73, 0x65, 0x72, 0x73, 0x22, 0x42, 0x0a, 0x0f, 0x4a, 0x6f, 0x69, 0x6e, 0x53, 0x70, 0x61, + 0x63, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x2f, 0x0a, 0x0a, 0x49, 0x6e, 0x76, 0x69, + 0x74, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x0f, 0xca, 0xbb, + 0x18, 0x0b, 0x69, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x52, 0x0a, 0x49, + 0x6e, 0x76, 0x69, 0x74, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x22, 0x6a, 0x0a, 0x0f, 0x4a, 0x6f, 0x69, + 0x6e, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x26, 0x0a, 0x07, + 0x53, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x0c, 0xca, + 0xbb, 0x18, 0x08, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x52, 0x07, 0x53, 0x70, 0x61, + 0x63, 0x65, 0x49, 0x64, 0x12, 0x2f, 0x0a, 0x0a, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x43, 0x6f, + 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0f, 0xca, 0xbb, 0x18, 0x0b, 0x69, 0x6e, + 0x76, 0x69, 0x74, 0x65, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x52, 0x0a, 0x49, 0x6e, 0x76, 0x69, 0x74, + 0x65, 0x43, 0x6f, 0x64, 0x65, 0x22, 0x11, 0x0a, 0x0f, 0x45, 0x78, 0x69, 0x74, 0x53, 0x70, 0x61, + 0x63, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x11, 0x0a, 0x0f, 0x45, 0x78, 0x69, 0x74, + 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x78, 0x0a, 0x15, 0x52, + 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, 0x70, 0x61, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x12, 0x30, 0x0a, 0x07, 0x53, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x16, 0xca, 0xbb, 0x18, 0x08, 0x73, 0x70, 0x61, 0x63, 0x65, + 0x5f, 0x69, 0x64, 0xda, 0xbb, 0x18, 0x06, 0x24, 0x20, 0x21, 0x3d, 0x20, 0x30, 0x52, 0x07, 0x53, + 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x12, 0x2d, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x42, 0x15, 0xca, 0xbb, 0x18, 0x07, 0x75, 0x73, 0x65, 0x72, + 0x5f, 0x69, 0x64, 0xda, 0xbb, 0x18, 0x06, 0x24, 0x20, 0x21, 0x3d, 0x20, 0x30, 0x52, 0x06, 0x55, + 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0x17, 0x0a, 0x15, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, + 0x70, 0x61, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0xae, + 0x01, 0x0a, 0x19, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x70, 0x61, 0x63, 0x65, 0x55, 0x73, + 0x65, 0x72, 0x52, 0x6f, 0x6c, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x30, 0x0a, 0x07, + 0x53, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x16, 0xca, + 0xbb, 0x18, 0x08, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0xda, 0xbb, 0x18, 0x06, 0x24, + 0x20, 0x21, 0x3d, 0x20, 0x30, 0x52, 0x07, 0x53, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x12, 0x2d, + 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x42, 0x15, + 0xca, 0xbb, 0x18, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0xda, 0xbb, 0x18, 0x06, 0x24, + 0x20, 0x21, 0x3d, 0x20, 0x30, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x30, 0x0a, + 0x04, 0x52, 0x6f, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x42, 0x1c, 0xca, 0xbb, 0x18, + 0x04, 0x72, 0x6f, 0x6c, 0x65, 0xda, 0xbb, 0x18, 0x10, 0x24, 0x20, 0x3d, 0x3d, 0x20, 0x31, 0x20, + 0x7c, 0x7c, 0x20, 0x24, 0x20, 0x3d, 0x3d, 0x20, 0x32, 0x52, 0x04, 0x52, 0x6f, 0x6c, 0x65, 0x22, + 0x1b, 0x0a, 0x19, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x70, 0x61, 0x63, 0x65, 0x55, 0x73, + 0x65, 0x72, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x42, 0x22, 0x5a, 0x20, 0x63, 0x6e, 0x2f, 0x6f, 0x6e, 0x65, 0x61, 0x6f, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2d, 0x67, 0x6f, 0x2f, 0x62, 0x69, 0x7a, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, @@ -159,17 +631,27 @@ func file_space_space_user_types_proto_rawDescGZIP() []byte { return file_space_space_user_types_proto_rawDescData } -var file_space_space_user_types_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_space_space_user_types_proto_msgTypes = make([]protoimpl.MessageInfo, 11) var file_space_space_user_types_proto_goTypes = []interface{}{ - (*InsertSpaceUserParams)(nil), // 0: space.InsertSpaceUserParams - (*InsertSpaceUserResult)(nil), // 1: space.InsertSpaceUserResult + (*ListSpaceUsersParams)(nil), // 0: space.ListSpaceUsersParams + (*SpaceUser)(nil), // 1: space.SpaceUser + (*ListSpaceUsersResult)(nil), // 2: space.ListSpaceUsersResult + (*JoinSpaceParams)(nil), // 3: space.JoinSpaceParams + (*JoinSpaceResult)(nil), // 4: space.JoinSpaceResult + (*ExitSpaceParams)(nil), // 5: space.ExitSpaceParams + (*ExitSpaceResult)(nil), // 6: space.ExitSpaceResult + (*RemoveSpaceUserParams)(nil), // 7: space.RemoveSpaceUserParams + (*RemoveSpaceUserResult)(nil), // 8: space.RemoveSpaceUserResult + (*UpdateSpaceUserRoleParams)(nil), // 9: space.UpdateSpaceUserRoleParams + (*UpdateSpaceUserRoleResult)(nil), // 10: space.UpdateSpaceUserRoleResult } var file_space_space_user_types_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 + 1, // 0: space.ListSpaceUsersResult.users:type_name -> space.SpaceUser + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name } func init() { file_space_space_user_types_proto_init() } @@ -179,7 +661,7 @@ func file_space_space_user_types_proto_init() { } if !protoimpl.UnsafeEnabled { file_space_space_user_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*InsertSpaceUserParams); i { + switch v := v.(*ListSpaceUsersParams); i { case 0: return &v.state case 1: @@ -191,7 +673,115 @@ func file_space_space_user_types_proto_init() { } } file_space_space_user_types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*InsertSpaceUserResult); i { + switch v := v.(*SpaceUser); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_space_space_user_types_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListSpaceUsersResult); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_space_space_user_types_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*JoinSpaceParams); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_space_space_user_types_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*JoinSpaceResult); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_space_space_user_types_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ExitSpaceParams); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_space_space_user_types_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ExitSpaceResult); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_space_space_user_types_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RemoveSpaceUserParams); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_space_space_user_types_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RemoveSpaceUserResult); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_space_space_user_types_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateSpaceUserRoleParams); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_space_space_user_types_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateSpaceUserRoleResult); i { case 0: return &v.state case 1: @@ -209,7 +799,7 @@ func file_space_space_user_types_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_space_space_user_types_proto_rawDesc, NumEnums: 0, - NumMessages: 2, + NumMessages: 11, NumExtensions: 0, NumServices: 0, }, diff --git a/code/base-project/base-go-v3/biz/router/money/index.go b/code/base-project/base-go-v3/biz/router/money/money.go similarity index 100% rename from code/base-project/base-go-v3/biz/router/money/index.go rename to code/base-project/base-go-v3/biz/router/money/money.go diff --git a/code/base-project/base-go-v3/biz/router/space/middleware.go b/code/base-project/base-go-v3/biz/router/space/middleware.go index 54fd3531..a5024ed3 100644 --- a/code/base-project/base-go-v3/biz/router/space/middleware.go +++ b/code/base-project/base-go-v3/biz/router/space/middleware.go @@ -20,3 +20,38 @@ func _insertspaceMw() []app.HandlerFunc { // your code... return nil } + +func _deletespaceMw() []app.HandlerFunc { + // your code... + return nil +} + +func _space_userMw() []app.HandlerFunc { + // your code... + return nil +} + +func _exitspaceMw() []app.HandlerFunc { + // your code... + return nil +} + +func _queryspaceusersMw() []app.HandlerFunc { + // your code... + return nil +} + +func _listspaceusersMw() []app.HandlerFunc { + // your code... + return nil +} + +func _removespaceuserMw() []app.HandlerFunc { + // your code... + return nil +} + +func _updatespaceuserroleMw() []app.HandlerFunc { + // your code... + return nil +} diff --git a/code/base-project/base-go-v3/biz/router/space/index.go b/code/base-project/base-go-v3/biz/router/space/space.go similarity index 59% rename from code/base-project/base-go-v3/biz/router/space/index.go rename to code/base-project/base-go-v3/biz/router/space/space.go index f697c502..416416db 100644 --- a/code/base-project/base-go-v3/biz/router/space/index.go +++ b/code/base-project/base-go-v3/biz/router/space/space.go @@ -19,6 +19,14 @@ func Register(r *server.Hertz) { root := r.Group("/", rootMw()...) { _space := root.Group("/space", _spaceMw()...) + _space.POST("/delete", append(_deletespaceMw(), space.DeleteSpace)...) _space.POST("/insert", append(_insertspaceMw(), space.InsertSpace)...) } + { + _space_user := root.Group("/space_user", _space_userMw()...) + _space_user.POST("/exit", append(_exitspaceMw(), space.ExitSpace)...) + _space_user.POST("/list", append(_listspaceusersMw(), space.ListSpaceUsers)...) + _space_user.POST("/remove", append(_removespaceuserMw(), space.RemoveSpaceUser)...) + _space_user.POST("/updateRole", append(_updatespaceuserroleMw(), space.UpdateSpaceUserRole)...) + } } diff --git a/code/base-project/base-go-v3/db/queries/space.sql b/code/base-project/base-go-v3/db/queries/space.sql index 5e841ef1..91e2d37e 100644 --- a/code/base-project/base-go-v3/db/queries/space.sql +++ b/code/base-project/base-go-v3/db/queries/space.sql @@ -18,19 +18,6 @@ FROM space s ON s.id = m.space_id WHERE m.user_id = $1; --- 获取空间下的所有用户信息 --- name: GetSpaceUsers :many -SELECT - u.id as user_id, - u.username, - su.role, - su.join_time -FROM space_user su - JOIN space s ON su.space_id = s.id - JOIN user_info u ON su.user_id = u.id -WHERE s.id = $1 -ORDER BY su.join_time ASC; - -- 根据验证码获取空间 -- name: GetSpaceByInviteCode :one SELECT * FROM space WHERE invite_code = $1; \ No newline at end of file diff --git a/code/base-project/base-go-v3/db/queries/space_user.sql b/code/base-project/base-go-v3/db/queries/space_user.sql index eacbfb2c..116022b7 100644 --- a/code/base-project/base-go-v3/db/queries/space_user.sql +++ b/code/base-project/base-go-v3/db/queries/space_user.sql @@ -17,3 +17,20 @@ UPDATE space_user SET role = $1 WHERE user_id = $2 AND space_id = $3; + +-- 获取空间下的所有用户信息 +-- name: ListSpaceUsers :many +SELECT + u.id as user_id, + u.username, + su.role, + su.join_time +FROM space_user su + JOIN space s ON su.space_id = s.id + JOIN user_info u ON su.user_id = u.id +WHERE s.id = $1 +ORDER BY su.join_time ASC; + + +-- name: GetSpaceUserByUserId :one +SELECT * FROM space_user WHERE user_id = $1; \ No newline at end of file diff --git a/code/base-project/base-go-v3/db/repo/space.sql.go b/code/base-project/base-go-v3/db/repo/space.sql.go index 2809e45c..abe5fa9e 100644 --- a/code/base-project/base-go-v3/db/repo/space.sql.go +++ b/code/base-project/base-go-v3/db/repo/space.sql.go @@ -7,8 +7,6 @@ package repo import ( "context" - - "github.com/jackc/pgx/v5/pgtype" ) const deleteSpace = `-- name: DeleteSpace :exec @@ -79,52 +77,6 @@ func (q *Queries) GetSpaceByUserId(ctx context.Context, userID int64) (Space, er return i, err } -const getSpaceUsers = `-- name: GetSpaceUsers :many -SELECT - u.id as user_id, - u.username, - su.role, - su.join_time -FROM space_user su - JOIN space s ON su.space_id = s.id - JOIN user_info u ON su.user_id = u.id -WHERE s.id = $1 -ORDER BY su.join_time ASC -` - -type GetSpaceUsersRow struct { - UserID int64 - Username pgtype.Text - Role int32 - JoinTime pgtype.Timestamp -} - -// 获取空间下的所有用户信息 -func (q *Queries) GetSpaceUsers(ctx context.Context, id int64) ([]GetSpaceUsersRow, error) { - rows, err := q.db.Query(ctx, getSpaceUsers, id) - if err != nil { - return nil, err - } - defer rows.Close() - var items []GetSpaceUsersRow - for rows.Next() { - var i GetSpaceUsersRow - if err := rows.Scan( - &i.UserID, - &i.Username, - &i.Role, - &i.JoinTime, - ); err != nil { - return nil, err - } - items = append(items, i) - } - if err := rows.Err(); err != nil { - return nil, err - } - return items, nil -} - const insertSpace = `-- name: InsertSpace :exec INSERT INTO space (id,invite_code) VALUES ($1,$2) ` diff --git a/code/base-project/base-go-v3/db/repo/space_user.sql.go b/code/base-project/base-go-v3/db/repo/space_user.sql.go index 543a7640..9b68524b 100644 --- a/code/base-project/base-go-v3/db/repo/space_user.sql.go +++ b/code/base-project/base-go-v3/db/repo/space_user.sql.go @@ -7,6 +7,8 @@ package repo import ( "context" + + "github.com/jackc/pgx/v5/pgtype" ) const deleteSpaceUser = `-- name: DeleteSpaceUser :exec @@ -29,6 +31,23 @@ func (q *Queries) DeleteSpaceUserAll(ctx context.Context, spaceID int64) error { return err } +const getSpaceUserByUserId = `-- name: GetSpaceUserByUserId :one +SELECT id, space_id, user_id, role, join_time FROM space_user WHERE user_id = $1 +` + +func (q *Queries) GetSpaceUserByUserId(ctx context.Context, userID int64) (SpaceUser, error) { + row := q.db.QueryRow(ctx, getSpaceUserByUserId, userID) + var i SpaceUser + err := row.Scan( + &i.ID, + &i.SpaceID, + &i.UserID, + &i.Role, + &i.JoinTime, + ) + return i, err +} + const insertSpaceUser = `-- name: InsertSpaceUser :exec INSERT INTO space_user(id,space_id,user_id,role) VALUES ($1,$2,$3,$4) @@ -52,6 +71,52 @@ func (q *Queries) InsertSpaceUser(ctx context.Context, arg InsertSpaceUserParams return err } +const listSpaceUsers = `-- name: ListSpaceUsers :many +SELECT + u.id as user_id, + u.username, + su.role, + su.join_time +FROM space_user su + JOIN space s ON su.space_id = s.id + JOIN user_info u ON su.user_id = u.id +WHERE s.id = $1 +ORDER BY su.join_time ASC +` + +type ListSpaceUsersRow struct { + UserID int64 + Username pgtype.Text + Role int32 + JoinTime pgtype.Timestamp +} + +// 获取空间下的所有用户信息 +func (q *Queries) ListSpaceUsers(ctx context.Context, id int64) ([]ListSpaceUsersRow, error) { + rows, err := q.db.Query(ctx, listSpaceUsers, id) + if err != nil { + return nil, err + } + defer rows.Close() + var items []ListSpaceUsersRow + for rows.Next() { + var i ListSpaceUsersRow + if err := rows.Scan( + &i.UserID, + &i.Username, + &i.Role, + &i.JoinTime, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + const updateSpaceUserRole = `-- name: UpdateSpaceUserRole :exec UPDATE space_user SET role = $1 diff --git a/code/base-project/base-go-v3/db/schema.sql b/code/base-project/base-go-v3/db/schema.sql index c153fd55..60eaadba 100644 --- a/code/base-project/base-go-v3/db/schema.sql +++ b/code/base-project/base-go-v3/db/schema.sql @@ -58,6 +58,9 @@ COMMENT ON COLUMN space.invite_code IS '空间邀请码'; COMMENT ON COLUMN space.create_time IS '空间创建时间'; COMMENT ON COLUMN space.update_time IS '空间更新时间'; +ALTER TABLE space + ADD CONSTRAINT space_invite_code_key UNIQUE (invite_code); + -- 空间成员表(每个用户只能加入一个空间) CREATE TABLE space_user ( diff --git a/code/base-project/base-go-v3/idl/money/index.proto b/code/base-project/base-go-v3/idl/money/money.proto similarity index 100% rename from code/base-project/base-go-v3/idl/money/index.proto rename to code/base-project/base-go-v3/idl/money/money.proto diff --git a/code/base-project/base-go-v3/idl/space/space.proto b/code/base-project/base-go-v3/idl/space/space.proto index deea7cde..aba40526 100644 --- a/code/base-project/base-go-v3/idl/space/space.proto +++ b/code/base-project/base-go-v3/idl/space/space.proto @@ -7,10 +7,31 @@ option go_package = "space"; import "api.proto"; import "space/space_types.proto"; -//import "space/space_user_types.proto"; +import "space/space_user_types.proto"; service SpaceService { rpc InsertSpace(InsertSpaceParams) returns (InsertSpaceResult){ option (api.post) = '/space/insert'; }; + + rpc DeleteSpace(DeleteSpaceParams) returns (DeleteSpaceResult){ + option (api.post) = '/space/delete'; + }; +} + +service SpaceUserService{ + rpc ExitSpace(ExitSpaceParams) returns (ExitSpaceResult){ + option (api.post) = '/space_user/exit'; + }; + rpc ListSpaceUsers(ListSpaceUsersParams) returns (ListSpaceUsersResult){ + option (api.post) = '/space_user/list'; + }; + // 踢出某人 + rpc RemoveSpaceUser(RemoveSpaceUserParams) returns (RemoveSpaceUserResult){ + option (api.post) = '/space_user/remove'; + }; + // 更新用户权限 + rpc UpdateSpaceUserRole(UpdateSpaceUserRoleParams) returns (UpdateSpaceUserRoleResult){ + option (api.post) = '/space_user/updateRole'; + }; } \ No newline at end of file diff --git a/code/base-project/base-go-v3/idl/space/space_types.proto b/code/base-project/base-go-v3/idl/space/space_types.proto index c57ee52f..7c4e00a6 100644 --- a/code/base-project/base-go-v3/idl/space/space_types.proto +++ b/code/base-project/base-go-v3/idl/space/space_types.proto @@ -24,16 +24,3 @@ message DeleteSpaceParams { message DeleteSpaceResult { } - -// 获取空间下的所有用户 -message QuerySpaceUsersParams{ - int64 SpaceId = 1 [(api.body)="space_id", (api.vd)="$ != 0"]; -} - -message SpaceUser { - -} - -message QuerySpaceUsersResult{ - -} \ No newline at end of file diff --git a/code/base-project/base-go-v3/idl/space/space_user_types.proto b/code/base-project/base-go-v3/idl/space/space_user_types.proto index 9c43c67e..8be5d220 100644 --- a/code/base-project/base-go-v3/idl/space/space_user_types.proto +++ b/code/base-project/base-go-v3/idl/space/space_user_types.proto @@ -5,13 +5,57 @@ package space; option go_package = "space"; import "api.proto"; +// 获取空间下的成员 +message ListSpaceUsersParams { + int64 SpaceId = 1 [(api.body)="space_id",(api.vd)="$ != 0"]; +} + +message SpaceUser { + int64 UserId = 1 [(api.body)="user_id"]; + string Username = 2 [(api.body)="username"]; + int32 SpaceRole = 4 [(api.body)="space_role"]; +} + +message ListSpaceUsersResult { + repeated SpaceUser users = 1; +} // 加入空间 -message InsertSpaceUserParams { +message JoinSpaceParams { int64 InviteCode = 1 [(api.body)="invite_code"]; // 邀请码 } -message InsertSpaceUserResult { +message JoinSpaceResult { int64 SpaceId = 1 [(api.body)="space_id"]; string InviteCode = 2 [(api.body)="invite_code"]; } + +// 退出空间 +message ExitSpaceParams { + +} + +message ExitSpaceResult { + +} + +// 踢出成员 +message RemoveSpaceUserParams { + int64 SpaceId = 1 [(api.body) = "space_id",(api.vd)="$ != 0"]; + int64 UserId = 2 [(api.body) = "user_id",(api.vd)="$ != 0"]; +} + +message RemoveSpaceUserResult { + +} + +// 更新用户权限 +message UpdateSpaceUserRoleParams { + int64 SpaceId = 1[(api.body) = "space_id",(api.vd)="$ != 0"]; + int64 UserId = 2[(api.body) = "user_id",(api.vd)="$ != 0"]; + int32 Role = 3 [(api.body) = "role", (api.vd) = "$ == 1 || $ == 2"]; +} + +message UpdateSpaceUserRoleResult{ + +} \ No newline at end of file