This commit is contained in:
oneao committed 2025-12-03 17:31:28 +08:00
1 parent e81f605999
commit cf9b01e633
26 files changed
+860 -935

No files matched your search

@@ -18,11 +18,11 @@ import (
"github.com/cloudwego/hertz/pkg/protocol/consts"
)
// InsertSpace .
// @router /space/insert [POST]
func InsertSpace(ctx context.Context, c *app.RequestContext) {
// CreateSpace .
// @router /space/create [POST]
func CreateSpace(ctx context.Context, c *app.RequestContext) {
var err error
var req space.InsertSpaceParams
var req space.CreateSpaceParams
err = c.BindAndValidate(&req)
if err != nil {
c.String(consts.StatusBadRequest, err.Error())
@@ -109,7 +109,7 @@ func InsertSpace(ctx context.Context, c *app.RequestContext) {
return
}
resp := &space.InsertSpaceResult{
resp := &space.CreateSpaceResult{
Id: spaceId,
InviteCode: inviteCode,
}
@@ -117,11 +117,11 @@ func InsertSpace(ctx context.Context, c *app.RequestContext) {
response.Success(c).Data(resp).Send()
}
// DeleteSpace .
// @router /space/delete [POST]
func DeleteSpace(ctx context.Context, c *app.RequestContext) {
// DissolveSpace .
// @router /space/dissolve [POST]
func DissolveSpace(ctx context.Context, c *app.RequestContext) {
var err error
var req space.DeleteSpaceParams
var req space.DissolveSpaceParams
err = c.BindAndValidate(&req)
if err != nil {
c.String(consts.StatusBadRequest, err.Error())
@@ -8,6 +8,7 @@ import (
"cn/oneao/base-go/db"
"cn/oneao/base-go/db/repo"
"cn/oneao/base-go/utils/errorx"
"cn/oneao/base-go/utils/idgen"
"cn/oneao/base-go/utils/response"
"context"
@@ -16,7 +17,7 @@ import (
)
// ExitSpace .
// @router /space_user/exit [POST]
// @router /space/user/exit [POST]
func ExitSpace(ctx context.Context, c *app.RequestContext) {
var err error
var req space.ExitSpaceParams
@@ -39,7 +40,7 @@ func ExitSpace(ctx context.Context, c *app.RequestContext) {
}
// ListSpaceUsers .
// @router /space_user/list [POST]
// @router /space/user/list [POST]
func ListSpaceUsers(ctx context.Context, c *app.RequestContext) {
var err error
var req space.ListSpaceUsersParams
@@ -49,16 +50,32 @@ func ListSpaceUsers(ctx context.Context, c *app.RequestContext) {
return
}
spaceId := req.SpaceId
// 先创建空返回对象
resp := &space.ListSpaceUsersResult{
Users: []*space.SpaceUser{},
}
userID := middleware.GetUserID(ctx)
// 获取用户所在空间
spaceByUserId, err := db.Queries.GetSpaceByUserId(ctx, userID)
if err != nil || errorx.IsNotFound(err) {
// 未加入空间或查询出错,直接返回空数组
response.Success(c).Data(resp).Send()
return
}
spaceId := spaceByUserId.ID
// 查询空间内用户
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,
@@ -71,7 +88,7 @@ func ListSpaceUsers(ctx context.Context, c *app.RequestContext) {
}
// RemoveSpaceUser .
// @router /space_user/remove [POST]
// @router /space/user/remove [POST]
func RemoveSpaceUser(ctx context.Context, c *app.RequestContext) {
var req space.RemoveSpaceUserParams
if err := c.BindAndValidate(&req); err != nil {
@@ -137,7 +154,7 @@ func RemoveSpaceUser(ctx context.Context, c *app.RequestContext) {
}
// UpdateSpaceUserRole .
// @router /space_user/updateRole [POST]
// @router /space/user/updateRole [POST]
func UpdateSpaceUserRole(ctx context.Context, c *app.RequestContext) {
var req space.UpdateSpaceUserRoleParams
if err := c.BindAndValidate(&req); err != nil {
@@ -163,16 +180,22 @@ func UpdateSpaceUserRole(ctx context.Context, c *app.RequestContext) {
return
}
// 3. 权限检查:只有创建者或管理员可以修改他人角色
// 3. 权限检查:只有创建者可以修改他人角色
// 假设 Role: 0=创建者, 1=管理员, 2=普通成员
if operator.Role != 0 && operator.Role != 1 {
if operator.Role != 0 {
response.Fail(c).Message("权限不足").Send()
return
}
// 3.1 不允许修改自己的角色
if operator.UserID == req.UserId {
response.Fail(c).Message("不能修改自己的角色").Send()
return
}
// 4. 校验目标 Role 是否合法
if req.Role != 1 && req.Role != 2 {
response.Fail(c).Message("Role 只能是 1 或 2").Send()
response.Fail(c).Message("角色修改错误").Send()
return
}
@@ -203,5 +226,96 @@ func UpdateSpaceUserRole(ctx context.Context, c *app.RequestContext) {
return
}
response.Success(c).Data().Send()
response.Success(c).Send()
}
// JoinSpace .
// @router /space/user/join [POST]
func JoinSpace(ctx context.Context, c *app.RequestContext) {
var err error
var req space.JoinSpaceParams
err = c.BindAndValidate(&req)
if err != nil {
c.String(consts.StatusBadRequest, err.Error())
return
}
userID := middleware.GetUserID(ctx)
inviteCode := req.InviteCode
// 检查该用户是否已加入其他空间
_, err = db.Queries.GetSpaceByUserId(ctx, userID)
if err != nil {
if errorx.IsNotFound(err) {
} else {
errorx.AddError(c, err)
}
} else {
response.Fail(c).Message("请先退出已加入的空间").Send()
return
}
// 检查验证码是否有效
spaceByCode, err := db.Queries.GetSpaceByInviteCode(ctx, inviteCode)
if err != nil {
if errorx.IsNotFound(err) {
response.Fail(c).Message("邀请码无效").Send()
return
} else {
errorx.AddError(c, err)
return
}
}
// 加入空间,默认
params := repo.InsertSpaceUserParams{
ID: idgen.NextId(),
SpaceID: spaceByCode.ID,
UserID: userID,
Role: 2,
}
err = db.Queries.InsertSpaceUser(ctx, params)
if err != nil {
errorx.AddError(c, err)
return
}
response.Success(c).Message("加入空间成功").Send()
}
// GetUserSpace .
// @router /space/user/get [GET]
func GetUserSpace(ctx context.Context, c *app.RequestContext) {
var err error
var req space.GetUserSpaceParams
err = c.BindAndValidate(&req)
if err != nil {
c.String(consts.StatusBadRequest, err.Error())
return
}
resp := new(space.GetUserSpaceResult)
userID := middleware.GetUserID(ctx)
spaceByUserId, err := db.Queries.GetSpaceByUserId(ctx, userID)
if err != nil {
if errorx.IsNotFound(err) {
response.Success(c).Data(nil).Send()
return
} else {
errorx.AddError(c, err)
return
}
}
resp.Id = spaceByUserId.ID
resp.Name = spaceByUserId.Name.String
resp.InviteCode = spaceByUserId.InviteCode
response.Success(c).Data(resp).Send()
}
@@ -3,7 +3,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.0
// protoc v6.33.1
// protoc v4.25.3
// source: api.proto
package api
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.0
// protoc v6.33.1
// protoc v4.25.3
// source: space.proto
package space
@@ -28,79 +28,97 @@ var file_space_proto_rawDesc = []byte{
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,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0xc2, 0x01, 0x0a, 0x0c, 0x53, 0x70, 0x61, 0x63, 0x65,
0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x54, 0x0a, 0x0b, 0x43, 0x72, 0x65, 0x61, 0x74,
0x65, 0x53, 0x70, 0x61, 0x63, 0x65, 0x12, 0x18, 0x2e, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, 0x43,
0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x70, 0x61, 0x63, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73,
0x1a, 0x18, 0x2e, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53,
0x70, 0x61, 0x63, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x11, 0xd2, 0xc1, 0x18, 0x0d,
0x2f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2f, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x12, 0x5c, 0x0a,
0x0d, 0x44, 0x69, 0x73, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x53, 0x70, 0x61, 0x63, 0x65, 0x12, 0x1a,
0x2e, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, 0x44, 0x69, 0x73, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x53,
0x70, 0x61, 0x63, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x1a, 0x2e, 0x73, 0x70, 0x61,
0x63, 0x65, 0x2e, 0x44, 0x69, 0x73, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x53, 0x70, 0x61, 0x63, 0x65,
0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x13, 0xd2, 0xc1, 0x18, 0x0f, 0x2f, 0x73, 0x70, 0x61,
0x63, 0x65, 0x2f, 0x64, 0x69, 0x73, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x32, 0xd3, 0x04, 0x0a, 0x10,
0x53, 0x70, 0x61, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
0x12, 0x59, 0x0a, 0x0c, 0x67, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x53, 0x70, 0x61, 0x63, 0x65,
0x12, 0x19, 0x2e, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72,
0x53, 0x70, 0x61, 0x63, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x19, 0x2e, 0x73, 0x70,
0x61, 0x63, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x53, 0x70, 0x61, 0x63, 0x65,
0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x13, 0xca, 0xc1, 0x18, 0x0f, 0x2f, 0x73, 0x70, 0x61,
0x63, 0x65, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x67, 0x65, 0x74, 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, 0x2f, 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, 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,
0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x14, 0xd2, 0xc1, 0x18, 0x10,
0x2f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2f, 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, 0x2f, 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, 0x2f, 0x75,
0x73, 0x65, 0x72, 0x2f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x6f, 0x6c, 0x65, 0x12, 0x51,
0x0a, 0x09, 0x4a, 0x6f, 0x69, 0x6e, 0x53, 0x70, 0x61, 0x63, 0x65, 0x12, 0x16, 0x2e, 0x73, 0x70,
0x61, 0x63, 0x65, 0x2e, 0x4a, 0x6f, 0x69, 0x6e, 0x53, 0x70, 0x61, 0x63, 0x65, 0x50, 0x61, 0x72,
0x61, 0x6d, 0x73, 0x1a, 0x16, 0x2e, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, 0x4a, 0x6f, 0x69, 0x6e,
0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x14, 0xd2, 0xc1, 0x18,
0x10, 0x2f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x6a, 0x6f, 0x69,
0x6e, 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
(*CreateSpaceParams)(nil), // 0: space.CreateSpaceParams
(*DissolveSpaceParams)(nil), // 1: space.DissolveSpaceParams
(*GetUserSpaceParams)(nil), // 2: space.GetUserSpaceParams
(*ExitSpaceParams)(nil), // 3: space.ExitSpaceParams
(*ListSpaceUsersParams)(nil), // 4: space.ListSpaceUsersParams
(*RemoveSpaceUserParams)(nil), // 5: space.RemoveSpaceUserParams
(*UpdateSpaceUserRoleParams)(nil), // 6: space.UpdateSpaceUserRoleParams
(*JoinSpaceParams)(nil), // 7: space.JoinSpaceParams
(*DissolveSpaceResult)(nil), // 8: space.DissolveSpaceResult
(*GetUserSpaceResult)(nil), // 9: space.GetUserSpaceResult
(*ExitSpaceResult)(nil), // 10: space.ExitSpaceResult
(*ListSpaceUsersResult)(nil), // 11: space.ListSpaceUsersResult
(*RemoveSpaceUserResult)(nil), // 12: space.RemoveSpaceUserResult
(*UpdateSpaceUserRoleResult)(nil), // 13: space.UpdateSpaceUserRoleResult
(*JoinSpaceResult)(nil), // 14: space.JoinSpaceResult
}
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: space.SpaceService.CreateSpace:input_type -> space.CreateSpaceParams
1, // 1: space.SpaceService.DissolveSpace:input_type -> space.DissolveSpaceParams
2, // 2: space.SpaceUserService.getUserSpace:input_type -> space.GetUserSpaceParams
3, // 3: space.SpaceUserService.ExitSpace:input_type -> space.ExitSpaceParams
4, // 4: space.SpaceUserService.ListSpaceUsers:input_type -> space.ListSpaceUsersParams
5, // 5: space.SpaceUserService.RemoveSpaceUser:input_type -> space.RemoveSpaceUserParams
6, // 6: space.SpaceUserService.UpdateSpaceUserRole:input_type -> space.UpdateSpaceUserRoleParams
7, // 7: space.SpaceUserService.JoinSpace:input_type -> space.JoinSpaceParams
0, // 8: space.SpaceService.CreateSpace:output_type -> space.CreateSpaceParams
8, // 9: space.SpaceService.DissolveSpace:output_type -> space.DissolveSpaceResult
9, // 10: space.SpaceUserService.getUserSpace:output_type -> space.GetUserSpaceResult
10, // 11: space.SpaceUserService.ExitSpace:output_type -> space.ExitSpaceResult
11, // 12: space.SpaceUserService.ListSpaceUsers:output_type -> space.ListSpaceUsersResult
12, // 13: space.SpaceUserService.RemoveSpaceUser:output_type -> space.RemoveSpaceUserResult
13, // 14: space.SpaceUserService.UpdateSpaceUserRole:output_type -> space.UpdateSpaceUserRoleResult
14, // 15: space.SpaceUserService.JoinSpace:output_type -> space.JoinSpaceResult
8, // [8:16] is the sub-list for method output_type
0, // [0:8] 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,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.0
// protoc v6.33.1
// protoc v4.25.3
// source: space/space_types.proto
package space
@@ -22,14 +22,14 @@ const (
)
// 创建空间
type InsertSpaceParams struct {
type CreateSpaceParams struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *InsertSpaceParams) Reset() {
*x = InsertSpaceParams{}
func (x *CreateSpaceParams) Reset() {
*x = CreateSpaceParams{}
if protoimpl.UnsafeEnabled {
mi := &file_space_space_types_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -37,13 +37,13 @@ func (x *InsertSpaceParams) Reset() {
}
}
func (x *InsertSpaceParams) String() string {
func (x *CreateSpaceParams) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*InsertSpaceParams) ProtoMessage() {}
func (*CreateSpaceParams) ProtoMessage() {}
func (x *InsertSpaceParams) ProtoReflect() protoreflect.Message {
func (x *CreateSpaceParams) ProtoReflect() protoreflect.Message {
mi := &file_space_space_types_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -55,12 +55,12 @@ func (x *InsertSpaceParams) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use InsertSpaceParams.ProtoReflect.Descriptor instead.
func (*InsertSpaceParams) Descriptor() ([]byte, []int) {
// Deprecated: Use CreateSpaceParams.ProtoReflect.Descriptor instead.
func (*CreateSpaceParams) Descriptor() ([]byte, []int) {
return file_space_space_types_proto_rawDescGZIP(), []int{0}
}
type InsertSpaceResult struct {
type CreateSpaceResult struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
@@ -69,8 +69,8 @@ type InsertSpaceResult struct {
InviteCode string `protobuf:"bytes,2,opt,name=InviteCode,proto3" form:"invite_code" json:"invite_code"`
}
func (x *InsertSpaceResult) Reset() {
*x = InsertSpaceResult{}
func (x *CreateSpaceResult) Reset() {
*x = CreateSpaceResult{}
if protoimpl.UnsafeEnabled {
mi := &file_space_space_types_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -78,13 +78,13 @@ func (x *InsertSpaceResult) Reset() {
}
}
func (x *InsertSpaceResult) String() string {
func (x *CreateSpaceResult) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*InsertSpaceResult) ProtoMessage() {}
func (*CreateSpaceResult) ProtoMessage() {}
func (x *InsertSpaceResult) ProtoReflect() protoreflect.Message {
func (x *CreateSpaceResult) ProtoReflect() protoreflect.Message {
mi := &file_space_space_types_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -96,19 +96,19 @@ func (x *InsertSpaceResult) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use InsertSpaceResult.ProtoReflect.Descriptor instead.
func (*InsertSpaceResult) Descriptor() ([]byte, []int) {
// Deprecated: Use CreateSpaceResult.ProtoReflect.Descriptor instead.
func (*CreateSpaceResult) Descriptor() ([]byte, []int) {
return file_space_space_types_proto_rawDescGZIP(), []int{1}
}
func (x *InsertSpaceResult) GetId() int64 {
func (x *CreateSpaceResult) GetId() int64 {
if x != nil {
return x.Id
}
return 0
}
func (x *InsertSpaceResult) GetInviteCode() string {
func (x *CreateSpaceResult) GetInviteCode() string {
if x != nil {
return x.InviteCode
}
@@ -116,14 +116,14 @@ func (x *InsertSpaceResult) GetInviteCode() string {
}
// 解散空间
type DeleteSpaceParams struct {
type DissolveSpaceParams struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *DeleteSpaceParams) Reset() {
*x = DeleteSpaceParams{}
func (x *DissolveSpaceParams) Reset() {
*x = DissolveSpaceParams{}
if protoimpl.UnsafeEnabled {
mi := &file_space_space_types_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -131,13 +131,13 @@ func (x *DeleteSpaceParams) Reset() {
}
}
func (x *DeleteSpaceParams) String() string {
func (x *DissolveSpaceParams) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DeleteSpaceParams) ProtoMessage() {}
func (*DissolveSpaceParams) ProtoMessage() {}
func (x *DeleteSpaceParams) ProtoReflect() protoreflect.Message {
func (x *DissolveSpaceParams) ProtoReflect() protoreflect.Message {
mi := &file_space_space_types_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -149,19 +149,19 @@ func (x *DeleteSpaceParams) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use DeleteSpaceParams.ProtoReflect.Descriptor instead.
func (*DeleteSpaceParams) Descriptor() ([]byte, []int) {
// Deprecated: Use DissolveSpaceParams.ProtoReflect.Descriptor instead.
func (*DissolveSpaceParams) Descriptor() ([]byte, []int) {
return file_space_space_types_proto_rawDescGZIP(), []int{2}
}
type DeleteSpaceResult struct {
type DissolveSpaceResult struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *DeleteSpaceResult) Reset() {
*x = DeleteSpaceResult{}
func (x *DissolveSpaceResult) Reset() {
*x = DissolveSpaceResult{}
if protoimpl.UnsafeEnabled {
mi := &file_space_space_types_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -169,13 +169,13 @@ func (x *DeleteSpaceResult) Reset() {
}
}
func (x *DeleteSpaceResult) String() string {
func (x *DissolveSpaceResult) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DeleteSpaceResult) ProtoMessage() {}
func (*DissolveSpaceResult) ProtoMessage() {}
func (x *DeleteSpaceResult) ProtoReflect() protoreflect.Message {
func (x *DissolveSpaceResult) ProtoReflect() protoreflect.Message {
mi := &file_space_space_types_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -187,8 +187,8 @@ func (x *DeleteSpaceResult) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use DeleteSpaceResult.ProtoReflect.Descriptor instead.
func (*DeleteSpaceResult) Descriptor() ([]byte, []int) {
// Deprecated: Use DissolveSpaceResult.ProtoReflect.Descriptor instead.
func (*DissolveSpaceResult) Descriptor() ([]byte, []int) {
return file_space_space_types_proto_rawDescGZIP(), []int{3}
}
@@ -197,20 +197,20 @@ var File_space_space_types_proto protoreflect.FileDescriptor
var file_space_space_types_proto_rawDesc = []byte{
0x0a, 0x17, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2f, 0x73, 0x70, 0x61, 0x63, 0x65, 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, 0x13, 0x0a, 0x11, 0x49,
0x6e, 0x73, 0x65, 0x72, 0x74, 0x53, 0x70, 0x61, 0x63, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73,
0x22, 0x5c, 0x0a, 0x11, 0x49, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52,
0x1a, 0x09, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x13, 0x0a, 0x11, 0x43,
0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x70, 0x61, 0x63, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73,
0x22, 0x5c, 0x0a, 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52,
0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x16, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
0x03, 0x42, 0x06, 0xca, 0xbb, 0x18, 0x02, 0x69, 0x64, 0x52, 0x02, 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, 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, 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,
0x64, 0x65, 0x52, 0x0a, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x22, 0x15,
0x0a, 0x13, 0x44, 0x69, 0x73, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x53, 0x70, 0x61, 0x63, 0x65, 0x50,
0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x15, 0x0a, 0x13, 0x44, 0x69, 0x73, 0x73, 0x6f, 0x6c, 0x76,
0x65, 0x53, 0x70, 0x61, 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 (
@@ -227,10 +227,10 @@ func file_space_space_types_proto_rawDescGZIP() []byte {
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
(*CreateSpaceParams)(nil), // 0: space.CreateSpaceParams
(*CreateSpaceResult)(nil), // 1: space.CreateSpaceResult
(*DissolveSpaceParams)(nil), // 2: space.DissolveSpaceParams
(*DissolveSpaceResult)(nil), // 3: space.DissolveSpaceResult
}
var file_space_space_types_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
@@ -247,7 +247,7 @@ func file_space_space_types_proto_init() {
}
if !protoimpl.UnsafeEnabled {
file_space_space_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*InsertSpaceParams); i {
switch v := v.(*CreateSpaceParams); i {
case 0:
return &v.state
case 1:
@@ -259,7 +259,7 @@ func file_space_space_types_proto_init() {
}
}
file_space_space_types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*InsertSpaceResult); i {
switch v := v.(*CreateSpaceResult); i {
case 0:
return &v.state
case 1:
@@ -271,7 +271,7 @@ func file_space_space_types_proto_init() {
}
}
file_space_space_types_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DeleteSpaceParams); i {
switch v := v.(*DissolveSpaceParams); i {
case 0:
return &v.state
case 1:
@@ -283,7 +283,7 @@ func file_space_space_types_proto_init() {
}
}
file_space_space_types_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DeleteSpaceResult); i {
switch v := v.(*DissolveSpaceResult); i {
case 0:
return &v.state
case 1:
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.0
// protoc v6.33.1
// protoc v4.25.3
// source: space/space_user_types.proto
package space
@@ -26,8 +26,6 @@ type ListSpaceUsersParams 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 *ListSpaceUsersParams) Reset() {
@@ -62,13 +60,6 @@ func (*ListSpaceUsersParams) Descriptor() ([]byte, []int) {
return file_space_space_user_types_proto_rawDescGZIP(), []int{0}
}
func (x *ListSpaceUsersParams) GetSpaceId() int64 {
if x != nil {
return x.SpaceId
}
return 0
}
type SpaceUser struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@@ -185,7 +176,7 @@ type JoinSpaceParams struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
InviteCode int64 `protobuf:"varint,1,opt,name=InviteCode,proto3" form:"invite_code" json:"invite_code"` // 邀请码
InviteCode string `protobuf:"bytes,1,opt,name=InviteCode,proto3" form:"invite_code" json:"invite_code" vd:"$ != ''"` // 邀请码
}
func (x *JoinSpaceParams) Reset() {
@@ -220,20 +211,17 @@ func (*JoinSpaceParams) Descriptor() ([]byte, []int) {
return file_space_space_user_types_proto_rawDescGZIP(), []int{3}
}
func (x *JoinSpaceParams) GetInviteCode() int64 {
func (x *JoinSpaceParams) GetInviteCode() string {
if x != nil {
return x.InviteCode
}
return 0
return ""
}
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() {
@@ -268,20 +256,6 @@ 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 *JoinSpaceResult) GetInviteCode() string {
if x != nil {
return x.InviteCode
}
return ""
}
// 退出空间
type ExitSpaceParams struct {
state protoimpl.MessageState
@@ -555,41 +529,135 @@ func (*UpdateSpaceUserRoleResult) Descriptor() ([]byte, []int) {
return file_space_space_user_types_proto_rawDescGZIP(), []int{10}
}
// 获取当前用户的空间信息
type GetUserSpaceParams struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *GetUserSpaceParams) Reset() {
*x = GetUserSpaceParams{}
if protoimpl.UnsafeEnabled {
mi := &file_space_space_user_types_proto_msgTypes[11]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetUserSpaceParams) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetUserSpaceParams) ProtoMessage() {}
func (x *GetUserSpaceParams) ProtoReflect() protoreflect.Message {
mi := &file_space_space_user_types_proto_msgTypes[11]
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 GetUserSpaceParams.ProtoReflect.Descriptor instead.
func (*GetUserSpaceParams) Descriptor() ([]byte, []int) {
return file_space_space_user_types_proto_rawDescGZIP(), []int{11}
}
type GetUserSpaceResult struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id int64 `protobuf:"varint,1,opt,name=Id,proto3" form:"id" json:"id"`
Name string `protobuf:"bytes,2,opt,name=Name,proto3" form:"name" json:"name"`
InviteCode string `protobuf:"bytes,3,opt,name=InviteCode,proto3" form:"invite_code" json:"invite_code"`
}
func (x *GetUserSpaceResult) Reset() {
*x = GetUserSpaceResult{}
if protoimpl.UnsafeEnabled {
mi := &file_space_space_user_types_proto_msgTypes[12]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetUserSpaceResult) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetUserSpaceResult) ProtoMessage() {}
func (x *GetUserSpaceResult) ProtoReflect() protoreflect.Message {
mi := &file_space_space_user_types_proto_msgTypes[12]
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 GetUserSpaceResult.ProtoReflect.Descriptor instead.
func (*GetUserSpaceResult) Descriptor() ([]byte, []int) {
return file_space_space_user_types_proto_rawDescGZIP(), []int{12}
}
func (x *GetUserSpaceResult) GetId() int64 {
if x != nil {
return x.Id
}
return 0
}
func (x *GetUserSpaceResult) GetName() string {
if x != nil {
return x.Name
}
return ""
}
func (x *GetUserSpaceResult) GetInviteCode() string {
if x != nil {
return x.InviteCode
}
return ""
}
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, 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,
0x22, 0x16, 0x0a, 0x14, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x70, 0x61, 0x63, 0x65, 0x55, 0x73, 0x65,
0x72, 0x73, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 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, 0x4d, 0x0a, 0x0f, 0x4a, 0x6f, 0x69, 0x6e, 0x53, 0x70, 0x61, 0x63, 0x65,
0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x3a, 0x0a, 0x0a, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65,
0x43, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x1a, 0xca, 0xbb, 0x18, 0x0b,
0x69, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0xda, 0xbb, 0x18, 0x07, 0x24,
0x20, 0x21, 0x3d, 0x20, 0x27, 0x27, 0x52, 0x0a, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x43, 0x6f,
0x64, 0x65, 0x22, 0x11, 0x0a, 0x0f, 0x4a, 0x6f, 0x69, 0x6e, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52,
0x65, 0x73, 0x75, 0x6c, 0x74, 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,
@@ -613,10 +681,19 @@ var file_space_space_user_types_proto_rawDesc = []byte{
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,
0x65, 0x72, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x14, 0x0a, 0x12,
0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x53, 0x70, 0x61, 0x63, 0x65, 0x50, 0x61, 0x72, 0x61,
0x6d, 0x73, 0x22, 0x7b, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x53, 0x70, 0x61,
0x63, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x16, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x01,
0x20, 0x01, 0x28, 0x03, 0x42, 0x06, 0xca, 0xbb, 0x18, 0x02, 0x69, 0x64, 0x52, 0x02, 0x49, 0x64,
0x12, 0x1c, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x08,
0xca, 0xbb, 0x18, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x52, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x2f,
0x0a, 0x0a, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x03, 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, 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 (
@@ -631,7 +708,7 @@ 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, 11)
var file_space_space_user_types_proto_msgTypes = make([]protoimpl.MessageInfo, 13)
var file_space_space_user_types_proto_goTypes = []interface{}{
(*ListSpaceUsersParams)(nil), // 0: space.ListSpaceUsersParams
(*SpaceUser)(nil), // 1: space.SpaceUser
@@ -644,6 +721,8 @@ var file_space_space_user_types_proto_goTypes = []interface{}{
(*RemoveSpaceUserResult)(nil), // 8: space.RemoveSpaceUserResult
(*UpdateSpaceUserRoleParams)(nil), // 9: space.UpdateSpaceUserRoleParams
(*UpdateSpaceUserRoleResult)(nil), // 10: space.UpdateSpaceUserRoleResult
(*GetUserSpaceParams)(nil), // 11: space.GetUserSpaceParams
(*GetUserSpaceResult)(nil), // 12: space.GetUserSpaceResult
}
var file_space_space_user_types_proto_depIdxs = []int32{
1, // 0: space.ListSpaceUsersResult.users:type_name -> space.SpaceUser
@@ -792,6 +871,30 @@ func file_space_space_user_types_proto_init() {
return nil
}
}
file_space_space_user_types_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetUserSpaceParams); 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[12].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetUserSpaceResult); 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{
@@ -799,7 +902,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: 11,
NumMessages: 13,
NumExtensions: 0,
NumServices: 0,
},
@@ -55,3 +55,28 @@ func _updatespaceuserroleMw() []app.HandlerFunc {
// your code...
return nil
}
func _joinspaceMw() []app.HandlerFunc {
// your code...
return nil
}
func _createspaceMw() []app.HandlerFunc {
// your code...
return nil
}
func _dissolvespaceMw() []app.HandlerFunc {
// your code...
return nil
}
func _userMw() []app.HandlerFunc {
// your code...
return nil
}
func _getuserspaceMw() []app.HandlerFunc {
// your code...
return nil
}
@@ -19,14 +19,16 @@ 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)...)
_space.POST("/create", append(_createspaceMw(), space.CreateSpace)...)
_space.POST("/dissolve", append(_dissolvespaceMw(), space.DissolveSpace)...)
{
_user := _space.Group("/user", _userMw()...)
_user.POST("/exit", append(_exitspaceMw(), space.ExitSpace)...)
_user.GET("/get", append(_getuserspaceMw(), space.GetUserSpace)...)
_user.POST("/join", append(_joinspaceMw(), space.JoinSpace)...)
_user.POST("/list", append(_listspaceusersMw(), space.ListSpaceUsers)...)
_user.POST("/remove", append(_removespaceuserMw(), space.RemoveSpaceUser)...)
_user.POST("/updateRole", append(_updatespaceuserroleMw(), space.UpdateSpaceUserRole)...)
}
}
}
@@ -33,4 +33,5 @@ ORDER BY su.join_time ASC;
-- name: GetSpaceUserByUserId :one
SELECT * FROM space_user WHERE user_id = $1;
SELECT * FROM space_user WHERE user_id = $1;
@@ -10,28 +10,38 @@ import "space/space_types.proto";
import "space/space_user_types.proto";
service SpaceService {
rpc InsertSpace(InsertSpaceParams) returns (InsertSpaceResult){
option (api.post) = '/space/insert';
rpc CreateSpace(CreateSpaceParams) returns (CreateSpaceParams){
option (api.post) = '/space/create';
};
rpc DeleteSpace(DeleteSpaceParams) returns (DeleteSpaceResult){
option (api.post) = '/space/delete';
rpc DissolveSpace(DissolveSpaceParams) returns (DissolveSpaceResult){
option (api.post) = '/space/dissolve';
};
}
service SpaceUserService{
rpc ExitSpace(ExitSpaceParams) returns (ExitSpaceResult){
option (api.post) = '/space_user/exit';
// 获取用户空间
rpc getUserSpace(GetUserSpaceParams) returns (GetUserSpaceResult){
option (api.get) = '/space/user/get';
};
// 退出空间
rpc ExitSpace(ExitSpaceParams) returns (ExitSpaceResult){
option (api.post) = '/space/user/exit';
};
// 获取空间用户列表
rpc ListSpaceUsers(ListSpaceUsersParams) returns (ListSpaceUsersResult){
option (api.post) = '/space_user/list';
option (api.post) = '/space/user/list';
};
// 踢出某人
rpc RemoveSpaceUser(RemoveSpaceUserParams) returns (RemoveSpaceUserResult){
option (api.post) = '/space_user/remove';
option (api.post) = '/space/user/remove';
};
// 更新用户权限
rpc UpdateSpaceUserRole(UpdateSpaceUserRoleParams) returns (UpdateSpaceUserRoleResult){
option (api.post) = '/space_user/updateRole';
option (api.post) = '/space/user/updateRole';
};
// 加入空间
rpc JoinSpace(JoinSpaceParams) returns (JoinSpaceResult) {
option (api.post) = "/space/user/join";
};
}
@@ -7,20 +7,21 @@ option go_package = "space";
import "api.proto";
// 创建空间
message InsertSpaceParams {
message CreateSpaceParams {
}
message InsertSpaceResult {
message CreateSpaceResult {
int64 Id = 1 [(api.body)="id"];
string InviteCode = 2 [(api.body)="invite_code"];
}
// 解散空间
message DeleteSpaceParams {
message DissolveSpaceParams {
}
message DeleteSpaceResult {
message DissolveSpaceResult {
}
@@ -7,7 +7,6 @@ option go_package = "space";
import "api.proto";
// 获取空间下的成员
message ListSpaceUsersParams {
int64 SpaceId = 1 [(api.body)="space_id",(api.vd)="$ != 0"];
}
message SpaceUser {
@@ -22,12 +21,11 @@ message ListSpaceUsersResult {
// 加入空间
message JoinSpaceParams {
int64 InviteCode = 1 [(api.body)="invite_code"]; // 邀请码
string InviteCode = 1 [(api.body)="invite_code",(api.vd)="$ != ''"]; // 邀请码
}
message JoinSpaceResult {
int64 SpaceId = 1 [(api.body)="space_id"];
string InviteCode = 2 [(api.body)="invite_code"];
}
// 退出空间
@@ -58,4 +56,14 @@ message UpdateSpaceUserRoleParams {
message UpdateSpaceUserRoleResult{
}
}
// 获取当前用户的空间信息
message GetUserSpaceParams{
}
message GetUserSpaceResult{
int64 Id = 1[(api.body)="id"];
string Name = 2[(api.body)="name"];
string InviteCode = 3[(api.body)="invite_code"];
}
@@ -11,7 +11,7 @@ import (
type Result struct {
Code int `json:"code"`
Message string `json:"message"`
Data interface{} `json:"data,omitempty"`
Data interface{} `json:"data"`
TrackId string `json:"trackId,omitempty"`
}
@@ -76,9 +76,9 @@ func (b *Builder) Data(data interface{}) *Builder {
// Send 发送响应
func (b *Builder) Send() {
if b.result.Data == nil {
b.result.Data = ""
}
//if b.result.Data == nil {
// b.result.Data = ""
//}
reqID := requestid.Get(b.c)
b.result.TrackId = reqID