u
This commit is contained in:
1 parent
5ca04f85ca
commit
d9c49b34db
17 files changed
+429
-152
No files matched your search
@@ -3,7 +3,6 @@
|
|||||||
package auth
|
package auth
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"allapp/biz/handler/space"
|
|
||||||
"allapp/biz/model/auth"
|
"allapp/biz/model/auth"
|
||||||
"allapp/conf"
|
"allapp/conf"
|
||||||
"allapp/db"
|
"allapp/db"
|
||||||
@@ -12,7 +11,6 @@ import (
|
|||||||
"allapp/utils/httpx"
|
"allapp/utils/httpx"
|
||||||
"allapp/utils/idgen"
|
"allapp/utils/idgen"
|
||||||
"allapp/utils/jwtx"
|
"allapp/utils/jwtx"
|
||||||
"allapp/utils/redisx"
|
|
||||||
"allapp/utils/response"
|
"allapp/utils/response"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
@@ -58,14 +56,6 @@ func LoginQq(ctx context.Context, c *app.RequestContext) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 初始化空间信息
|
|
||||||
err := InitUserSpaces(ctx, user.UserID)
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
errorx.AddError(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
_ = db.Queries.UpdateUserLastLoginTime(ctx, user.UserID)
|
_ = db.Queries.UpdateUserLastLoginTime(ctx, user.UserID)
|
||||||
token, _ := jwtx.CreateToken(user.UserID)
|
token, _ := jwtx.CreateToken(user.UserID)
|
||||||
|
|
||||||
@@ -150,14 +140,6 @@ func LoginWx(ctx context.Context, c *app.RequestContext) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 初始化用户空间信息
|
|
||||||
err := InitUserSpaces(ctx, user.UserID)
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
errorx.AddError(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
_ = db.Queries.UpdateUserLastLoginTime(ctx, user.UserID)
|
_ = db.Queries.UpdateUserLastLoginTime(ctx, user.UserID)
|
||||||
token, _ := jwtx.CreateToken(user.UserID)
|
token, _ := jwtx.CreateToken(user.UserID)
|
||||||
|
|
||||||
@@ -202,13 +184,6 @@ func registerUser(ctx context.Context, c *app.RequestContext, openid, nickname,
|
|||||||
}
|
}
|
||||||
|
|
||||||
err := db.WithTx(ctx, func(q *repo.Queries) error {
|
err := db.WithTx(ctx, func(q *repo.Queries) error {
|
||||||
// 确保空间存在
|
|
||||||
err := space.EnsureUserHasSpaceWithTx(ctx, q, userId)
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// 插入用户
|
// 插入用户
|
||||||
if err := q.InsertUser(ctx, repo.InsertUserParams{
|
if err := q.InsertUser(ctx, repo.InsertUserParams{
|
||||||
ID: userId,
|
ID: userId,
|
||||||
@@ -242,14 +217,6 @@ func registerUser(ctx context.Context, c *app.RequestContext, openid, nickname,
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 初始化用户空间信息
|
|
||||||
err = InitUserSpaces(ctx, userId)
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
errorx.AddError(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
token, _ := jwtx.CreateToken(userId)
|
token, _ := jwtx.CreateToken(userId)
|
||||||
resp := &auth.LoginResp{
|
resp := &auth.LoginResp{
|
||||||
Token: token,
|
Token: token,
|
||||||
@@ -291,18 +258,3 @@ func initMoneyCategoryTx(ctx context.Context, q *repo.Queries, userId int64) err
|
|||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// 初始化用户空间信息
|
|
||||||
func InitUserSpaces(ctx context.Context, userID int64) error {
|
|
||||||
spaces, err := db.Queries.ListUserSpaces(ctx, userID)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
spaceRoles := make(map[int64]int32, len(spaces))
|
|
||||||
for _, row := range spaces {
|
|
||||||
spaceRoles[row.ID] = row.Role
|
|
||||||
}
|
|
||||||
|
|
||||||
return redisx.SetUserSpaces(ctx, userID, spaceRoles)
|
|
||||||
}
|
|
||||||
@@ -113,7 +113,7 @@ func CreateSpace(ctx context.Context, c *app.RequestContext) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
resp.Id = spaceId
|
resp.SpaceId = spaceId
|
||||||
resp.InviteCode = inviteCode
|
resp.InviteCode = inviteCode
|
||||||
|
|
||||||
response.Success(c).Data(resp).Send()
|
response.Success(c).Data(resp).Send()
|
||||||
@@ -184,6 +184,8 @@ func ExitSpace(ctx context.Context, c *app.RequestContext) {
|
|||||||
|
|
||||||
resp := new(space.ExitSpaceResult)
|
resp := new(space.ExitSpaceResult)
|
||||||
|
|
||||||
|
exitSpaceId := req.SpaceId
|
||||||
|
|
||||||
userID := middleware.GetUserID(ctx)
|
userID := middleware.GetUserID(ctx)
|
||||||
|
|
||||||
spaceUser, err := db.Queries.GetSpaceUser(ctx, userID)
|
spaceUser, err := db.Queries.GetSpaceUser(ctx, userID)
|
||||||
@@ -197,6 +199,11 @@ func ExitSpace(ctx context.Context, c *app.RequestContext) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if spaceUser.SpaceID != exitSpaceId {
|
||||||
|
response.Success(c).Data(resp).Send()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if spaceUser.Role == 0 {
|
if spaceUser.Role == 0 {
|
||||||
response.Fail(c).Message("请选择解散空间").Send()
|
response.Fail(c).Message("请选择解散空间").Send()
|
||||||
return
|
return
|
||||||
@@ -364,8 +371,87 @@ func JoinSpace(ctx context.Context, c *app.RequestContext) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
resp.Id = spaceByInviteCode.ID
|
resp.SpaceId = spaceByInviteCode.ID
|
||||||
resp.Name = spaceByInviteCode.Name.String
|
resp.SpaceName = spaceByInviteCode.Name.String
|
||||||
|
|
||||||
|
response.Success(c).Data(resp).Send()
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateSpaceUserRole .
|
||||||
|
// @router /space/updateRole [POST]
|
||||||
|
func UpdateSpaceUserRole(ctx context.Context, c *app.RequestContext) {
|
||||||
|
var err error
|
||||||
|
var req space.UpdateSpaceUserRoleParams
|
||||||
|
err = c.BindAndValidate(&req)
|
||||||
|
if err != nil {
|
||||||
|
c.String(consts.StatusBadRequest, err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp := new(space.UpdateSpaceUserRoleResult)
|
||||||
|
|
||||||
|
userID := middleware.GetUserID(ctx)
|
||||||
|
spaceID := req.SpaceId
|
||||||
|
updateUserID := req.UserId
|
||||||
|
|
||||||
|
hasPermission, err := hasSpacePermission(ctx, userID, spaceID)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
errorx.AddError(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if !hasPermission {
|
||||||
|
response.Fail(c).Message("无权限操作该空间").Send()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查是否在该空间
|
||||||
|
updateSpaceUser, err := db.Queries.GetSpaceUser(ctx, updateUserID)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
if errorx.IsNotFound(err) {
|
||||||
|
response.Fail(c).Message("授权失败,该用户不在该空间").Send()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
errorx.AddError(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if updateSpaceUser.SpaceID != spaceID {
|
||||||
|
response.Fail(c).Message("授权失败,该用户不在该空间").Send()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新
|
||||||
|
err = db.WithTx(ctx, func(q *repo.Queries) error {
|
||||||
|
err2 := q.UpdateSpaceUserRole(ctx, repo.UpdateSpaceUserRoleParams{
|
||||||
|
Role: 1,
|
||||||
|
SpaceID: spaceID,
|
||||||
|
UserID: userID,
|
||||||
|
})
|
||||||
|
|
||||||
|
if err2 != nil {
|
||||||
|
return err2
|
||||||
|
}
|
||||||
|
|
||||||
|
err2 = q.UpdateSpaceUserRole(ctx, repo.UpdateSpaceUserRoleParams{
|
||||||
|
Role: 0,
|
||||||
|
SpaceID: spaceID,
|
||||||
|
UserID: updateUserID,
|
||||||
|
})
|
||||||
|
|
||||||
|
if err2 != nil {
|
||||||
|
return err2
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
errorx.AddError(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
response.Success(c).Data(resp).Send()
|
response.Success(c).Data(resp).Send()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.28.0
|
// protoc-gen-go v1.28.0
|
||||||
// protoc v6.33.1
|
// protoc v4.25.3
|
||||||
// source: api.proto
|
// source: api.proto
|
||||||
|
|
||||||
package api
|
package api
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.28.0
|
// protoc-gen-go v1.28.0
|
||||||
// protoc v6.33.1
|
// protoc v4.25.3
|
||||||
// source: space.proto
|
// source: space.proto
|
||||||
|
|
||||||
package space
|
package space
|
||||||
@@ -26,7 +26,7 @@ var file_space_proto_rawDesc = []byte{
|
|||||||
0x0a, 0x0b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x73,
|
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,
|
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,
|
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, 0x9e, 0x04, 0x0a, 0x0c, 0x53, 0x70, 0x61,
|
0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x90, 0x05, 0x0a, 0x0c, 0x53, 0x70, 0x61,
|
||||||
0x63, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x54, 0x0a, 0x0b, 0x43, 0x72, 0x65,
|
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,
|
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,
|
0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x70, 0x61, 0x63, 0x65, 0x50, 0x61, 0x72, 0x61,
|
||||||
@@ -60,9 +60,16 @@ var file_space_proto_rawDesc = []byte{
|
|||||||
0x2e, 0x4a, 0x6f, 0x69, 0x6e, 0x53, 0x70, 0x61, 0x63, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73,
|
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,
|
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, 0x0f, 0xd2, 0xc1, 0x18, 0x0b, 0x2f, 0x73,
|
0x63, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x0f, 0xd2, 0xc1, 0x18, 0x0b, 0x2f, 0x73,
|
||||||
0x70, 0x61, 0x63, 0x65, 0x2f, 0x6a, 0x6f, 0x69, 0x6e, 0x42, 0x18, 0x5a, 0x16, 0x61, 0x6c, 0x6c,
|
0x70, 0x61, 0x63, 0x65, 0x2f, 0x6a, 0x6f, 0x69, 0x6e, 0x12, 0x70, 0x0a, 0x13, 0x55, 0x70, 0x64,
|
||||||
0x61, 0x70, 0x70, 0x2f, 0x62, 0x69, 0x7a, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2f, 0x73, 0x70,
|
0x61, 0x74, 0x65, 0x53, 0x70, 0x61, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x6f, 0x6c, 0x65,
|
||||||
0x61, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
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, 0x15, 0xd2, 0xc1, 0x18, 0x11, 0x2f, 0x73, 0x70, 0x61, 0x63, 0x65,
|
||||||
|
0x2f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x6f, 0x6c, 0x65, 0x42, 0x18, 0x5a, 0x16, 0x61,
|
||||||
|
0x6c, 0x6c, 0x61, 0x70, 0x70, 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{}{
|
var file_space_proto_goTypes = []interface{}{
|
||||||
@@ -72,11 +79,13 @@ var file_space_proto_goTypes = []interface{}{
|
|||||||
(*ListSpaceUsersParams)(nil), // 3: space.ListSpaceUsersParams
|
(*ListSpaceUsersParams)(nil), // 3: space.ListSpaceUsersParams
|
||||||
(*RemoveSpaceUserParams)(nil), // 4: space.RemoveSpaceUserParams
|
(*RemoveSpaceUserParams)(nil), // 4: space.RemoveSpaceUserParams
|
||||||
(*JoinSpaceParams)(nil), // 5: space.JoinSpaceParams
|
(*JoinSpaceParams)(nil), // 5: space.JoinSpaceParams
|
||||||
(*DissolveSpaceResult)(nil), // 6: space.DissolveSpaceResult
|
(*UpdateSpaceUserRoleParams)(nil), // 6: space.UpdateSpaceUserRoleParams
|
||||||
(*ExitSpaceResult)(nil), // 7: space.ExitSpaceResult
|
(*DissolveSpaceResult)(nil), // 7: space.DissolveSpaceResult
|
||||||
(*ListSpaceUsersResult)(nil), // 8: space.ListSpaceUsersResult
|
(*ExitSpaceResult)(nil), // 8: space.ExitSpaceResult
|
||||||
(*RemoveSpaceUserResult)(nil), // 9: space.RemoveSpaceUserResult
|
(*ListSpaceUsersResult)(nil), // 9: space.ListSpaceUsersResult
|
||||||
(*JoinSpaceResult)(nil), // 10: space.JoinSpaceResult
|
(*RemoveSpaceUserResult)(nil), // 10: space.RemoveSpaceUserResult
|
||||||
|
(*JoinSpaceResult)(nil), // 11: space.JoinSpaceResult
|
||||||
|
(*UpdateSpaceUserRoleResult)(nil), // 12: space.UpdateSpaceUserRoleResult
|
||||||
}
|
}
|
||||||
var file_space_proto_depIdxs = []int32{
|
var file_space_proto_depIdxs = []int32{
|
||||||
0, // 0: space.SpaceService.CreateSpace:input_type -> space.CreateSpaceParams
|
0, // 0: space.SpaceService.CreateSpace:input_type -> space.CreateSpaceParams
|
||||||
@@ -85,14 +94,16 @@ var file_space_proto_depIdxs = []int32{
|
|||||||
3, // 3: space.SpaceService.ListSpaceUsers:input_type -> space.ListSpaceUsersParams
|
3, // 3: space.SpaceService.ListSpaceUsers:input_type -> space.ListSpaceUsersParams
|
||||||
4, // 4: space.SpaceService.RemoveSpaceUser:input_type -> space.RemoveSpaceUserParams
|
4, // 4: space.SpaceService.RemoveSpaceUser:input_type -> space.RemoveSpaceUserParams
|
||||||
5, // 5: space.SpaceService.JoinSpace:input_type -> space.JoinSpaceParams
|
5, // 5: space.SpaceService.JoinSpace:input_type -> space.JoinSpaceParams
|
||||||
0, // 6: space.SpaceService.CreateSpace:output_type -> space.CreateSpaceParams
|
6, // 6: space.SpaceService.UpdateSpaceUserRole:input_type -> space.UpdateSpaceUserRoleParams
|
||||||
6, // 7: space.SpaceService.DissolveSpace:output_type -> space.DissolveSpaceResult
|
0, // 7: space.SpaceService.CreateSpace:output_type -> space.CreateSpaceParams
|
||||||
7, // 8: space.SpaceService.ExitSpace:output_type -> space.ExitSpaceResult
|
7, // 8: space.SpaceService.DissolveSpace:output_type -> space.DissolveSpaceResult
|
||||||
8, // 9: space.SpaceService.ListSpaceUsers:output_type -> space.ListSpaceUsersResult
|
8, // 9: space.SpaceService.ExitSpace:output_type -> space.ExitSpaceResult
|
||||||
9, // 10: space.SpaceService.RemoveSpaceUser:output_type -> space.RemoveSpaceUserResult
|
9, // 10: space.SpaceService.ListSpaceUsers:output_type -> space.ListSpaceUsersResult
|
||||||
10, // 11: space.SpaceService.JoinSpace:output_type -> space.JoinSpaceResult
|
10, // 11: space.SpaceService.RemoveSpaceUser:output_type -> space.RemoveSpaceUserResult
|
||||||
6, // [6:12] is the sub-list for method output_type
|
11, // 12: space.SpaceService.JoinSpace:output_type -> space.JoinSpaceResult
|
||||||
0, // [0:6] is the sub-list for method input_type
|
12, // 13: space.SpaceService.UpdateSpaceUserRole:output_type -> space.UpdateSpaceUserRoleResult
|
||||||
|
7, // [7:14] is the sub-list for method output_type
|
||||||
|
0, // [0:7] 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 type_name
|
||||||
0, // [0:0] is the sub-list for extension extendee
|
0, // [0:0] is the sub-list for extension extendee
|
||||||
0, // [0:0] is the sub-list for field type_name
|
0, // [0:0] is the sub-list for field type_name
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.28.0
|
// protoc-gen-go v1.28.0
|
||||||
// protoc v6.33.1
|
// protoc v4.25.3
|
||||||
// source: space/space_types.proto
|
// source: space/space_types.proto
|
||||||
|
|
||||||
package space
|
package space
|
||||||
@@ -74,7 +74,7 @@ type CreateSpaceResult struct {
|
|||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
Id int64 `protobuf:"varint,1,opt,name=Id,proto3" form:"id" json:"id"`
|
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"`
|
InviteCode string `protobuf:"bytes,2,opt,name=InviteCode,proto3" form:"invite_code" json:"invite_code"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,9 +110,9 @@ func (*CreateSpaceResult) Descriptor() ([]byte, []int) {
|
|||||||
return file_space_space_types_proto_rawDescGZIP(), []int{1}
|
return file_space_space_types_proto_rawDescGZIP(), []int{1}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *CreateSpaceResult) GetId() int64 {
|
func (x *CreateSpaceResult) GetSpaceId() int64 {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Id
|
return x.SpaceId
|
||||||
}
|
}
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@@ -437,8 +437,8 @@ type JoinSpaceResult struct {
|
|||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
Id int64 `protobuf:"varint,1,opt,name=Id,proto3" form:"id" json:"id"`
|
SpaceId int64 `protobuf:"varint,1,opt,name=SpaceId,proto3" form:"space_id" json:"space_id"`
|
||||||
Name string `protobuf:"bytes,2,opt,name=Name,proto3" form:"name" json:"name"`
|
SpaceName string `protobuf:"bytes,2,opt,name=SpaceName,proto3" form:"space_name" json:"space_name"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *JoinSpaceResult) Reset() {
|
func (x *JoinSpaceResult) Reset() {
|
||||||
@@ -473,16 +473,16 @@ func (*JoinSpaceResult) Descriptor() ([]byte, []int) {
|
|||||||
return file_space_space_types_proto_rawDescGZIP(), []int{8}
|
return file_space_space_types_proto_rawDescGZIP(), []int{8}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *JoinSpaceResult) GetId() int64 {
|
func (x *JoinSpaceResult) GetSpaceId() int64 {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Id
|
return x.SpaceId
|
||||||
}
|
}
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *JoinSpaceResult) GetName() string {
|
func (x *JoinSpaceResult) GetSpaceName() string {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Name
|
return x.SpaceName
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
@@ -492,6 +492,8 @@ type ExitSpaceParams struct {
|
|||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
SpaceId int64 `protobuf:"varint,1,opt,name=SpaceId,proto3" form:"space_id" json:"space_id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *ExitSpaceParams) Reset() {
|
func (x *ExitSpaceParams) Reset() {
|
||||||
@@ -526,6 +528,13 @@ func (*ExitSpaceParams) Descriptor() ([]byte, []int) {
|
|||||||
return file_space_space_types_proto_rawDescGZIP(), []int{9}
|
return file_space_space_types_proto_rawDescGZIP(), []int{9}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *ExitSpaceParams) GetSpaceId() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.SpaceId
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
type ExitSpaceResult struct {
|
type ExitSpaceResult struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
@@ -658,6 +667,108 @@ func (*RemoveSpaceUserResult) Descriptor() ([]byte, []int) {
|
|||||||
return file_space_space_types_proto_rawDescGZIP(), []int{12}
|
return file_space_space_types_proto_rawDescGZIP(), []int{12}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 更新权限
|
||||||
|
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:"$ != 0"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *UpdateSpaceUserRoleParams) Reset() {
|
||||||
|
*x = UpdateSpaceUserRoleParams{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_space_space_types_proto_msgTypes[13]
|
||||||
|
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_types_proto_msgTypes[13]
|
||||||
|
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_types_proto_rawDescGZIP(), []int{13}
|
||||||
|
}
|
||||||
|
|
||||||
|
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_types_proto_msgTypes[14]
|
||||||
|
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_types_proto_msgTypes[14]
|
||||||
|
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_types_proto_rawDescGZIP(), []int{14}
|
||||||
|
}
|
||||||
|
|
||||||
var File_space_space_types_proto protoreflect.FileDescriptor
|
var File_space_space_types_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_space_space_types_proto_rawDesc = []byte{
|
var file_space_space_types_proto_rawDesc = []byte{
|
||||||
@@ -666,10 +777,11 @@ var file_space_space_types_proto_rawDesc = []byte{
|
|||||||
0x1a, 0x09, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x31, 0x0a, 0x11, 0x43,
|
0x1a, 0x09, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x31, 0x0a, 0x11, 0x43,
|
||||||
0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x70, 0x61, 0x63, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73,
|
0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x70, 0x61, 0x63, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73,
|
||||||
0x12, 0x1c, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x08,
|
0x12, 0x1c, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x08,
|
||||||
0xca, 0xbb, 0x18, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x52, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x5c,
|
0xca, 0xbb, 0x18, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x52, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x6c,
|
||||||
0x0a, 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x73,
|
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,
|
0x75, 0x6c, 0x74, 0x12, 0x26, 0x0a, 0x07, 0x53, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x18, 0x01,
|
||||||
0x06, 0xca, 0xbb, 0x18, 0x02, 0x69, 0x64, 0x52, 0x02, 0x49, 0x64, 0x12, 0x2f, 0x0a, 0x0a, 0x49,
|
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,
|
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,
|
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, 0x3d, 0x0a, 0x13,
|
0x52, 0x0a, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x22, 0x3d, 0x0a, 0x13,
|
||||||
@@ -703,26 +815,42 @@ var file_space_space_types_proto_rawDesc = []byte{
|
|||||||
0x6d, 0x73, 0x12, 0x3a, 0x0a, 0x0a, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x43, 0x6f, 0x64, 0x65,
|
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,
|
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,
|
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, 0x47,
|
0x27, 0x27, 0x52, 0x0a, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x22, 0x67,
|
||||||
0x0a, 0x0f, 0x4a, 0x6f, 0x69, 0x6e, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c,
|
0x0a, 0x0f, 0x4a, 0x6f, 0x69, 0x6e, 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,
|
0x74, 0x12, 0x26, 0x0a, 0x07, 0x53, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01,
|
||||||
0xbb, 0x18, 0x02, 0x69, 0x64, 0x52, 0x02, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x04, 0x4e, 0x61, 0x6d,
|
0x28, 0x03, 0x42, 0x0c, 0xca, 0xbb, 0x18, 0x08, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64,
|
||||||
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x08, 0xca, 0xbb, 0x18, 0x04, 0x6e, 0x61, 0x6d,
|
0x52, 0x07, 0x53, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x12, 0x2c, 0x0a, 0x09, 0x53, 0x70, 0x61,
|
||||||
0x65, 0x52, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x11, 0x0a, 0x0f, 0x45, 0x78, 0x69, 0x74, 0x53,
|
0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, 0xca, 0xbb,
|
||||||
0x70, 0x61, 0x63, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x11, 0x0a, 0x0f, 0x45, 0x78,
|
0x18, 0x0a, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x52, 0x09, 0x53, 0x70,
|
||||||
0x69, 0x74, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x78, 0x0a,
|
0x61, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x39, 0x0a, 0x0f, 0x45, 0x78, 0x69, 0x74, 0x53,
|
||||||
0x15, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, 0x70, 0x61, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72,
|
0x70, 0x61, 0x63, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 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, 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, 0xa4, 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,
|
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,
|
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,
|
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,
|
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,
|
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,
|
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,
|
0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x26, 0x0a, 0x04, 0x52, 0x6f, 0x6c, 0x65, 0x18,
|
||||||
0x65, 0x53, 0x70, 0x61, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74,
|
0x03, 0x20, 0x01, 0x28, 0x05, 0x42, 0x12, 0xca, 0xbb, 0x18, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0xda,
|
||||||
0x42, 0x18, 0x5a, 0x16, 0x61, 0x6c, 0x6c, 0x61, 0x70, 0x70, 0x2f, 0x62, 0x69, 0x7a, 0x2f, 0x6d,
|
0xbb, 0x18, 0x06, 0x24, 0x20, 0x21, 0x3d, 0x20, 0x30, 0x52, 0x04, 0x52, 0x6f, 0x6c, 0x65, 0x22,
|
||||||
0x6f, 0x64, 0x65, 0x6c, 0x2f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
|
0x1b, 0x0a, 0x19, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x70, 0x61, 0x63, 0x65, 0x55, 0x73,
|
||||||
0x6f, 0x33,
|
0x65, 0x72, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x42, 0x18, 0x5a, 0x16,
|
||||||
|
0x61, 0x6c, 0x6c, 0x61, 0x70, 0x70, 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 (
|
var (
|
||||||
@@ -737,7 +865,7 @@ func file_space_space_types_proto_rawDescGZIP() []byte {
|
|||||||
return file_space_space_types_proto_rawDescData
|
return file_space_space_types_proto_rawDescData
|
||||||
}
|
}
|
||||||
|
|
||||||
var file_space_space_types_proto_msgTypes = make([]protoimpl.MessageInfo, 13)
|
var file_space_space_types_proto_msgTypes = make([]protoimpl.MessageInfo, 15)
|
||||||
var file_space_space_types_proto_goTypes = []interface{}{
|
var file_space_space_types_proto_goTypes = []interface{}{
|
||||||
(*CreateSpaceParams)(nil), // 0: space.CreateSpaceParams
|
(*CreateSpaceParams)(nil), // 0: space.CreateSpaceParams
|
||||||
(*CreateSpaceResult)(nil), // 1: space.CreateSpaceResult
|
(*CreateSpaceResult)(nil), // 1: space.CreateSpaceResult
|
||||||
@@ -752,6 +880,8 @@ var file_space_space_types_proto_goTypes = []interface{}{
|
|||||||
(*ExitSpaceResult)(nil), // 10: space.ExitSpaceResult
|
(*ExitSpaceResult)(nil), // 10: space.ExitSpaceResult
|
||||||
(*RemoveSpaceUserParams)(nil), // 11: space.RemoveSpaceUserParams
|
(*RemoveSpaceUserParams)(nil), // 11: space.RemoveSpaceUserParams
|
||||||
(*RemoveSpaceUserResult)(nil), // 12: space.RemoveSpaceUserResult
|
(*RemoveSpaceUserResult)(nil), // 12: space.RemoveSpaceUserResult
|
||||||
|
(*UpdateSpaceUserRoleParams)(nil), // 13: space.UpdateSpaceUserRoleParams
|
||||||
|
(*UpdateSpaceUserRoleResult)(nil), // 14: space.UpdateSpaceUserRoleResult
|
||||||
}
|
}
|
||||||
var file_space_space_types_proto_depIdxs = []int32{
|
var file_space_space_types_proto_depIdxs = []int32{
|
||||||
5, // 0: space.ListSpaceUsersResult.users:type_name -> space.SpaceUser
|
5, // 0: space.ListSpaceUsersResult.users:type_name -> space.SpaceUser
|
||||||
@@ -924,6 +1054,30 @@ func file_space_space_types_proto_init() {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
file_space_space_types_proto_msgTypes[13].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_types_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*UpdateSpaceUserRoleResult); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
type x struct{}
|
type x struct{}
|
||||||
out := protoimpl.TypeBuilder{
|
out := protoimpl.TypeBuilder{
|
||||||
@@ -931,7 +1085,7 @@ func file_space_space_types_proto_init() {
|
|||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_space_space_types_proto_rawDesc,
|
RawDescriptor: file_space_space_types_proto_rawDesc,
|
||||||
NumEnums: 0,
|
NumEnums: 0,
|
||||||
NumMessages: 13,
|
NumMessages: 15,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
NumServices: 0,
|
NumServices: 0,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -3,10 +3,8 @@ package middleware
|
|||||||
import (
|
import (
|
||||||
"allapp/utils/jwtx"
|
"allapp/utils/jwtx"
|
||||||
"allapp/utils/pathx"
|
"allapp/utils/pathx"
|
||||||
"allapp/utils/redisx"
|
|
||||||
"allapp/utils/response"
|
"allapp/utils/response"
|
||||||
"context"
|
"context"
|
||||||
"strconv"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/cloudwego/hertz/pkg/app"
|
"github.com/cloudwego/hertz/pkg/app"
|
||||||
@@ -19,7 +17,6 @@ type ctxKeyUser struct{}
|
|||||||
type ContextUser struct {
|
type ContextUser struct {
|
||||||
UserID int64
|
UserID int64
|
||||||
DeviceUUID string
|
DeviceUUID string
|
||||||
SpaceID int64
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Auth 中间件,支持 header 中传 spaceid 并校验权限
|
// Auth 中间件,支持 header 中传 spaceid 并校验权限
|
||||||
@@ -50,27 +47,9 @@ func Auth() app.HandlerFunc {
|
|||||||
|
|
||||||
userID := verifyToken.UserID
|
userID := verifyToken.UserID
|
||||||
|
|
||||||
// 获取 header 中的 spaceid
|
|
||||||
spaceIDStr := strings.TrimSpace(string(c.GetHeader("X-Space-Id")))
|
|
||||||
spaceID, err := strconv.ParseInt(spaceIDStr, 10, 64)
|
|
||||||
if err != nil || spaceID == 0 {
|
|
||||||
response.Fail(c).Code(response.HttpCode.ErrSpaceRequired).Message("请先选择空间").Send()
|
|
||||||
c.Abort()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// 判断用户是否在该空间
|
|
||||||
inSpace, err := redisx.InSpace(ctx, userID, spaceID)
|
|
||||||
if err != nil || !inSpace {
|
|
||||||
response.Fail(c).Code(response.HttpCode.ErrSpaceRequired).Message("无权限访问该空间").Send()
|
|
||||||
c.Abort()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// 设置 context
|
// 设置 context
|
||||||
user := &ContextUser{
|
user := &ContextUser{
|
||||||
UserID: userID,
|
UserID: userID,
|
||||||
SpaceID: spaceID,
|
|
||||||
}
|
}
|
||||||
ctx = setContextUser(ctx, user)
|
ctx = setContextUser(ctx, user)
|
||||||
|
|
||||||
@@ -92,11 +71,6 @@ func GetUserID(ctx context.Context) int64 {
|
|||||||
return GetContextUser(ctx).UserID
|
return GetContextUser(ctx).UserID
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetSpaceID 从 context 获取当前 spaceid
|
|
||||||
func GetSpaceID(ctx context.Context) int64 {
|
|
||||||
return GetContextUser(ctx).SpaceID
|
|
||||||
}
|
|
||||||
|
|
||||||
// 内部中间件设置 ContextUser
|
// 内部中间件设置 ContextUser
|
||||||
func setContextUser(ctx context.Context, user *ContextUser) context.Context {
|
func setContextUser(ctx context.Context, user *ContextUser) context.Context {
|
||||||
return context.WithValue(ctx, ctxKeyUser{}, user)
|
return context.WithValue(ctx, ctxKeyUser{}, user)
|
||||||
|
|||||||
@@ -45,3 +45,13 @@ func _listspaceusersMw() []app.HandlerFunc {
|
|||||||
// your code...
|
// your code...
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func _updateroleMw() []app.HandlerFunc {
|
||||||
|
// your code...
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func _updatespaceuserroleMw() []app.HandlerFunc {
|
||||||
|
// your code...
|
||||||
|
return nil
|
||||||
|
}
|
||||||
@@ -24,6 +24,7 @@ func Register(r *server.Hertz) {
|
|||||||
_space.POST("/exit", append(_exitspaceMw(), space.ExitSpace)...)
|
_space.POST("/exit", append(_exitspaceMw(), space.ExitSpace)...)
|
||||||
_space.POST("/join", append(_joinspaceMw(), space.JoinSpace)...)
|
_space.POST("/join", append(_joinspaceMw(), space.JoinSpace)...)
|
||||||
_space.POST("/remove", append(_removespaceuserMw(), space.RemoveSpaceUser)...)
|
_space.POST("/remove", append(_removespaceuserMw(), space.RemoveSpaceUser)...)
|
||||||
|
_space.POST("/updateRole", append(_updatespaceuserroleMw(), space.UpdateSpaceUserRole)...)
|
||||||
_space.POST("/users", append(_listspaceusersMw(), space.ListSpaceUsers)...)
|
_space.POST("/users", append(_listspaceusersMw(), space.ListSpaceUsers)...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -41,4 +41,4 @@ WHERE space_id = $1;
|
|||||||
-- name: UpdateSpaceUserRole :exec
|
-- name: UpdateSpaceUserRole :exec
|
||||||
UPDATE space_user
|
UPDATE space_user
|
||||||
SET role = $1
|
SET role = $1
|
||||||
WHERE user_id = $2;
|
WHERE user_id = $2 AND space_id = $3;
|
||||||
@@ -143,16 +143,17 @@ func (q *Queries) ListSpaceUsers(ctx context.Context, spaceID int64) ([]ListSpac
|
|||||||
const updateSpaceUserRole = `-- name: UpdateSpaceUserRole :exec
|
const updateSpaceUserRole = `-- name: UpdateSpaceUserRole :exec
|
||||||
UPDATE space_user
|
UPDATE space_user
|
||||||
SET role = $1
|
SET role = $1
|
||||||
WHERE user_id = $2
|
WHERE user_id = $2 AND space_id = $3
|
||||||
`
|
`
|
||||||
|
|
||||||
type UpdateSpaceUserRoleParams struct {
|
type UpdateSpaceUserRoleParams struct {
|
||||||
Role int32
|
Role int32
|
||||||
UserID int64
|
UserID int64
|
||||||
|
SpaceID int64
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修改角色
|
// 修改角色
|
||||||
func (q *Queries) UpdateSpaceUserRole(ctx context.Context, arg UpdateSpaceUserRoleParams) error {
|
func (q *Queries) UpdateSpaceUserRole(ctx context.Context, arg UpdateSpaceUserRoleParams) error {
|
||||||
_, err := q.db.Exec(ctx, updateSpaceUserRole, arg.Role, arg.UserID)
|
_, err := q.db.Exec(ctx, updateSpaceUserRole, arg.Role, arg.UserID, arg.SpaceID)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -38,4 +38,9 @@ service SpaceService {
|
|||||||
rpc JoinSpace(JoinSpaceParams) returns (JoinSpaceResult) {
|
rpc JoinSpace(JoinSpaceParams) returns (JoinSpaceResult) {
|
||||||
option (api.post) = "/space/join";
|
option (api.post) = "/space/join";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 赋予权限
|
||||||
|
rpc UpdateSpaceUserRole(UpdateSpaceUserRoleParams) returns (UpdateSpaceUserRoleResult) {
|
||||||
|
option (api.post) = "/space/updateRole";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -12,7 +12,7 @@ message CreateSpaceParams {
|
|||||||
}
|
}
|
||||||
|
|
||||||
message CreateSpaceResult {
|
message CreateSpaceResult {
|
||||||
int64 Id = 1 [(api.body)="id"];
|
int64 SpaceId = 1 [(api.body)="space_id"];
|
||||||
string InviteCode = 2 [(api.body)="invite_code"];
|
string InviteCode = 2 [(api.body)="invite_code"];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,13 +48,13 @@ message JoinSpaceParams {
|
|||||||
}
|
}
|
||||||
|
|
||||||
message JoinSpaceResult {
|
message JoinSpaceResult {
|
||||||
int64 Id = 1 [(api.body)="id"];
|
int64 SpaceId = 1 [(api.body)="space_id"];
|
||||||
string Name = 2 [(api.body)="name"];
|
string SpaceName = 2 [(api.body)="space_name"];
|
||||||
}
|
}
|
||||||
|
|
||||||
// 退出空间
|
// 退出空间
|
||||||
message ExitSpaceParams {
|
message ExitSpaceParams {
|
||||||
|
int64 SpaceId = 1 [(api.body)="space_id"];
|
||||||
}
|
}
|
||||||
|
|
||||||
message ExitSpaceResult {
|
message ExitSpaceResult {
|
||||||
@@ -71,4 +71,13 @@ 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)="$ != 0"];
|
||||||
|
}
|
||||||
|
|
||||||
|
message UpdateSpaceUserRoleResult {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,20 +1,54 @@
|
|||||||
import type { JoinSpaceParams, KickOutUserParams, ListSpaceUsersResult } from '@/types/space/space'
|
import type {
|
||||||
|
CreateSpaceParams,
|
||||||
|
CreateSpaceResult,
|
||||||
|
DissolveSpaceParams,
|
||||||
|
DissolveSpaceResult,
|
||||||
|
ExitSpaceParams,
|
||||||
|
ExitSpaceResult,
|
||||||
|
JoinSpaceParams,
|
||||||
|
JoinSpaceResult,
|
||||||
|
ListSpaceUsersParams,
|
||||||
|
ListSpaceUsersResult,
|
||||||
|
RemoveSpaceUserParams,
|
||||||
|
RemoveSpaceUserResult,
|
||||||
|
UpdateSpaceUserRoleParams,
|
||||||
|
UpdateSpaceUserRoleResult,
|
||||||
|
} from '@/types/space/space'
|
||||||
import alovaInstance from '../../index'
|
import alovaInstance from '../../index'
|
||||||
|
|
||||||
const API_PREFIX = '/space'
|
const API_PREFIX = '/space'
|
||||||
|
|
||||||
|
// Join Space API
|
||||||
export function joinSpaceApi(params: JoinSpaceParams) {
|
export function joinSpaceApi(params: JoinSpaceParams) {
|
||||||
return alovaInstance.Post<ResponseData<void>>(`${API_PREFIX}/join`, params)
|
return alovaInstance.Post<ResponseData<JoinSpaceResult>>(`${API_PREFIX}/join`, params)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function kickOutUserApi(params: KickOutUserParams) {
|
// Create Space API
|
||||||
return alovaInstance.Post<ResponseData<void>>(`${API_PREFIX}/kick`, params)
|
export function createSpaceApi(params: CreateSpaceParams) {
|
||||||
|
return alovaInstance.Post<ResponseData<CreateSpaceResult>>(`${API_PREFIX}/create`, params)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function quitSpaceApi() {
|
// Dissolve Space API
|
||||||
return alovaInstance.Post<ResponseData<void>>(`${API_PREFIX}/quit`)
|
export function dissolveSpaceApi(params: DissolveSpaceParams) {
|
||||||
|
return alovaInstance.Post<ResponseData<DissolveSpaceResult>>(`${API_PREFIX}/dissolve`, params)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function listSpaceUsersApi() {
|
// Exit Space API
|
||||||
return alovaInstance.Post<ResponseData<ListSpaceUsersResult>>(`${API_PREFIX}/users`)
|
export function exitSpaceApi(params: ExitSpaceParams) {
|
||||||
|
return alovaInstance.Post<ResponseData<ExitSpaceResult>>(`${API_PREFIX}/exit`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove Space User API
|
||||||
|
export function removeSpaceUserApi(params: RemoveSpaceUserParams) {
|
||||||
|
return alovaInstance.Post<ResponseData<RemoveSpaceUserResult>>(`${API_PREFIX}/remove`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update Role API
|
||||||
|
export function updateSpaceUserRoleApi(params: UpdateSpaceUserRoleParams) {
|
||||||
|
return alovaInstance.Post<ResponseData<UpdateSpaceUserRoleResult>>(`${API_PREFIX}/updateRole`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
// List Space Users API
|
||||||
|
export function listSpaceUsersApi(params: ListSpaceUsersParams) {
|
||||||
|
return alovaInstance.Post<ResponseData<ListSpaceUsersResult>>(`${API_PREFIX}/users`, params)
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
import type { ListUserSpacesResult } from '@/types/user'
|
import type { UserSpace } from '@/types/user'
|
||||||
import alovaInstance from '../index'
|
import alovaInstance from '../index'
|
||||||
|
|
||||||
const API_PREFIX = '/user'
|
const API_PREFIX = '/user'
|
||||||
|
|
||||||
export function listUserSpacesApi() {
|
export function getUserSpaceApi() {
|
||||||
return alovaInstance.Post<ResponseData<ListUserSpacesResult>>(`${API_PREFIX}/spaces`)
|
return alovaInstance.Post<ResponseData<UserSpace>>(`${API_PREFIX}/space`)
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import { create } from 'zustand'
|
import { create } from 'zustand'
|
||||||
import { getUserSpaceApi } from '@/request/api/space/spaceUser'
|
import { getUserSpaceApi } from '@/request/api/user'
|
||||||
import { useMoneyCategoryStore } from './moneyCategory'
|
import { useMoneyCategoryStore } from './moneyCategory'
|
||||||
import { useNavStore } from './navigation'
|
import { useNavStore } from './navigation'
|
||||||
import { useSpaceStore } from './space'
|
import { useSpaceStore } from './space'
|
||||||
|
|||||||
@@ -1,22 +1,66 @@
|
|||||||
|
// 创建空间
|
||||||
|
export interface CreateSpaceParams {
|
||||||
|
name: string
|
||||||
|
}
|
||||||
|
export interface CreateSpaceResult {
|
||||||
|
space_id: number
|
||||||
|
invite_code: string
|
||||||
|
}
|
||||||
|
|
||||||
|
// 解散空间
|
||||||
|
export interface DissolveSpaceParams {
|
||||||
|
space_id: number
|
||||||
|
}
|
||||||
|
export interface DissolveSpaceResult {
|
||||||
|
}
|
||||||
|
|
||||||
// 加入空间
|
// 加入空间
|
||||||
export interface JoinSpaceParams {
|
export interface JoinSpaceParams {
|
||||||
invite_code: string
|
invite_code: string
|
||||||
}
|
}
|
||||||
|
export interface JoinSpaceResult {
|
||||||
|
space_id: number
|
||||||
|
space_name: string
|
||||||
|
}
|
||||||
|
|
||||||
|
// 退出空间
|
||||||
|
export interface ExitSpaceParams {
|
||||||
|
space_id: number
|
||||||
|
}
|
||||||
|
export interface ExitSpaceResult {
|
||||||
|
}
|
||||||
|
|
||||||
// 踢出用户
|
// 踢出用户
|
||||||
export interface KickOutUserParams {
|
export interface RemoveSpaceUserParams {
|
||||||
|
space_id: number
|
||||||
user_id: number
|
user_id: number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface RemoveSpaceUserResult {
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新用户权限
|
||||||
|
export interface UpdateSpaceUserRoleParams {
|
||||||
|
space_id: number
|
||||||
|
user_id: number
|
||||||
|
role: number
|
||||||
|
}
|
||||||
|
export interface UpdateSpaceUserRoleResult {
|
||||||
|
}
|
||||||
|
|
||||||
// 空间用户列表
|
// 空间用户列表
|
||||||
export interface SpaceUser {
|
export interface SpaceUser {
|
||||||
user_id: number
|
id: number
|
||||||
user_name: number
|
name: number
|
||||||
user_avatar: string
|
avatar: string
|
||||||
role: number
|
role: number
|
||||||
|
last_login_time: number
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ListSpaceUsersParams {
|
||||||
|
space_id: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ListSpaceUsersResult {
|
export interface ListSpaceUsersResult {
|
||||||
users: SpaceUser[]
|
users: SpaceUser[]
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4,7 +4,3 @@ export interface UserSpace {
|
|||||||
invite_code: string
|
invite_code: string
|
||||||
role: number
|
role: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ListUserSpacesResult {
|
|
||||||
spaces: UserSpace[]
|
|
||||||
}
|
|
||||||
Reference in new issue
Block a user