wfz 3 жил өмнө
parent
commit
52407a4a35

+ 22 - 14
api/account/account.pb.go

@@ -675,8 +675,14 @@ var file_account_proto_rawDesc = []byte{
 	0x65, 0x22, 0x32, 0x0a, 0x0a, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12,
 	0x10, 0x0a, 0x03, 0x70, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x70, 0x69,
 	0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
-	0x04, 0x74, 0x79, 0x70, 0x65, 0x32, 0x88, 0x04, 0x0a, 0x07, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e,
-	0x74, 0x12, 0x62, 0x0a, 0x0a, 0x44, 0x65, 0x62, 0x75, 0x67, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x12,
+	0x04, 0x74, 0x79, 0x70, 0x65, 0x32, 0xe8, 0x04, 0x0a, 0x07, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e,
+	0x74, 0x12, 0x5e, 0x0a, 0x0e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x65, 0x73, 0x74, 0x55,
+	0x73, 0x65, 0x72, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f,
+	0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x16, 0x2e, 0x67, 0x6f,
+	0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d,
+	0x70, 0x74, 0x79, 0x22, 0x1c, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x16, 0x22, 0x11, 0x2f, 0x61, 0x70,
+	0x69, 0x2f, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x2f, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x3a, 0x01,
+	0x2a, 0x12, 0x62, 0x0a, 0x0a, 0x44, 0x65, 0x62, 0x75, 0x67, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x12,
 	0x1e, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x2e, 0x44, 0x65,
 	0x62, 0x75, 0x67, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
 	0x17, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x2e, 0x54, 0x6f,
@@ -742,18 +748,20 @@ var file_account_proto_goTypes = []interface{}{
 	(*emptypb.Empty)(nil),         // 10: google.protobuf.Empty
 }
 var file_account_proto_depIdxs = []int32{
-	8,  // 0: api.account.Account.DebugLogin:input_type -> api.account.DebugLoginRequest
-	6,  // 1: api.account.Account.Authorization:input_type -> api.account.AuthorizationRequest
-	2,  // 2: api.account.Account.SendPhoneCode:input_type -> api.account.SendPhoneCodeRequest
-	3,  // 3: api.account.Account.CheckPhoneCode:input_type -> api.account.CheckPhoneCodeRequest
-	0,  // 4: api.account.Account.GetIdentityByOpenID:input_type -> api.account.OpenIDRequest
-	7,  // 5: api.account.Account.DebugLogin:output_type -> api.account.TokenReply
-	7,  // 6: api.account.Account.Authorization:output_type -> api.account.TokenReply
-	10, // 7: api.account.Account.SendPhoneCode:output_type -> google.protobuf.Empty
-	10, // 8: api.account.Account.CheckPhoneCode:output_type -> google.protobuf.Empty
-	1,  // 9: api.account.Account.GetIdentityByOpenID:output_type -> api.account.IdentityInfo
-	5,  // [5:10] is the sub-list for method output_type
-	0,  // [0:5] is the sub-list for method input_type
+	10, // 0: api.account.Account.CreateTestUser:input_type -> google.protobuf.Empty
+	8,  // 1: api.account.Account.DebugLogin:input_type -> api.account.DebugLoginRequest
+	6,  // 2: api.account.Account.Authorization:input_type -> api.account.AuthorizationRequest
+	2,  // 3: api.account.Account.SendPhoneCode:input_type -> api.account.SendPhoneCodeRequest
+	3,  // 4: api.account.Account.CheckPhoneCode:input_type -> api.account.CheckPhoneCodeRequest
+	0,  // 5: api.account.Account.GetIdentityByOpenID:input_type -> api.account.OpenIDRequest
+	10, // 6: api.account.Account.CreateTestUser:output_type -> google.protobuf.Empty
+	7,  // 7: api.account.Account.DebugLogin:output_type -> api.account.TokenReply
+	7,  // 8: api.account.Account.Authorization:output_type -> api.account.TokenReply
+	10, // 9: api.account.Account.SendPhoneCode:output_type -> google.protobuf.Empty
+	10, // 10: api.account.Account.CheckPhoneCode:output_type -> google.protobuf.Empty
+	1,  // 11: api.account.Account.GetIdentityByOpenID:output_type -> api.account.IdentityInfo
+	6,  // [6:12] is the sub-list for method output_type
+	0,  // [0:6] is the sub-list for method input_type
 	0,  // [0:0] is the sub-list for extension type_name
 	0,  // [0:0] is the sub-list for extension extendee
 	0,  // [0:0] is the sub-list for field type_name

+ 6 - 0
api/account/account.proto

@@ -12,6 +12,12 @@ option java_multiple_files = true;
 option java_package = "api.account";
 
 service Account {
+  rpc CreateTestUser (google.protobuf.Empty) returns (google.protobuf.Empty){
+    option (google.api.http) = {
+      post: "/api/login/create",
+      body:"*"
+    };
+  };
   rpc DebugLogin (DebugLoginRequest) returns (TokenReply){
     option (google.api.http) = {
       post: "/api/login/debug",

+ 36 - 0
api/account/account_grpc.pb.go

@@ -19,6 +19,7 @@ const _ = grpc.SupportPackageIsVersion7
 //
 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
 type AccountClient interface {
+	CreateTestUser(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error)
 	DebugLogin(ctx context.Context, in *DebugLoginRequest, opts ...grpc.CallOption) (*TokenReply, error)
 	Authorization(ctx context.Context, in *AuthorizationRequest, opts ...grpc.CallOption) (*TokenReply, error)
 	SendPhoneCode(ctx context.Context, in *SendPhoneCodeRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
@@ -34,6 +35,15 @@ func NewAccountClient(cc grpc.ClientConnInterface) AccountClient {
 	return &accountClient{cc}
 }
 
+func (c *accountClient) CreateTestUser(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error) {
+	out := new(emptypb.Empty)
+	err := c.cc.Invoke(ctx, "/api.account.Account/CreateTestUser", in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
 func (c *accountClient) DebugLogin(ctx context.Context, in *DebugLoginRequest, opts ...grpc.CallOption) (*TokenReply, error) {
 	out := new(TokenReply)
 	err := c.cc.Invoke(ctx, "/api.account.Account/DebugLogin", in, out, opts...)
@@ -83,6 +93,7 @@ func (c *accountClient) GetIdentityByOpenID(ctx context.Context, in *OpenIDReque
 // All implementations must embed UnimplementedAccountServer
 // for forward compatibility
 type AccountServer interface {
+	CreateTestUser(context.Context, *emptypb.Empty) (*emptypb.Empty, error)
 	DebugLogin(context.Context, *DebugLoginRequest) (*TokenReply, error)
 	Authorization(context.Context, *AuthorizationRequest) (*TokenReply, error)
 	SendPhoneCode(context.Context, *SendPhoneCodeRequest) (*emptypb.Empty, error)
@@ -95,6 +106,9 @@ type AccountServer interface {
 type UnimplementedAccountServer struct {
 }
 
+func (UnimplementedAccountServer) CreateTestUser(context.Context, *emptypb.Empty) (*emptypb.Empty, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method CreateTestUser not implemented")
+}
 func (UnimplementedAccountServer) DebugLogin(context.Context, *DebugLoginRequest) (*TokenReply, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method DebugLogin not implemented")
 }
@@ -123,6 +137,24 @@ func RegisterAccountServer(s grpc.ServiceRegistrar, srv AccountServer) {
 	s.RegisterService(&Account_ServiceDesc, srv)
 }
 
+func _Account_CreateTestUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(emptypb.Empty)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(AccountServer).CreateTestUser(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/api.account.Account/CreateTestUser",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(AccountServer).CreateTestUser(ctx, req.(*emptypb.Empty))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
 func _Account_DebugLogin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
 	in := new(DebugLoginRequest)
 	if err := dec(in); err != nil {
@@ -220,6 +252,10 @@ var Account_ServiceDesc = grpc.ServiceDesc{
 	ServiceName: "api.account.Account",
 	HandlerType: (*AccountServer)(nil),
 	Methods: []grpc.MethodDesc{
+		{
+			MethodName: "CreateTestUser",
+			Handler:    _Account_CreateTestUser_Handler,
+		},
 		{
 			MethodName: "DebugLogin",
 			Handler:    _Account_DebugLogin_Handler,

+ 43 - 0
api/account/account_http.pb.go

@@ -29,18 +29,47 @@ const _ = http.SupportPackageIsVersion1
 type AccountHTTPServer interface {
 	Authorization(context.Context, *AuthorizationRequest) (*TokenReply, error)
 	CheckPhoneCode(context.Context, *CheckPhoneCodeRequest) (*emptypb.Empty, error)
+	CreateTestUser(context.Context, *emptypb.Empty) (*emptypb.Empty, error)
 	DebugLogin(context.Context, *DebugLoginRequest) (*TokenReply, error)
 	SendPhoneCode(context.Context, *SendPhoneCodeRequest) (*emptypb.Empty, error)
 }
 
 func RegisterAccountHTTPServer(s *http.Server, srv AccountHTTPServer) {
 	r := s.Route("/")
+	r.POST("/api/login/create", _Account_CreateTestUser0_HTTP_Handler(srv))
 	r.POST("/api/login/debug", _Account_DebugLogin0_HTTP_Handler(srv))
 	r.POST("/api/login/authorization", _Account_Authorization0_HTTP_Handler(srv))
 	r.POST("/api/user/code/send", _Account_SendPhoneCode0_HTTP_Handler(srv))
 	r.POST("/api/user/code/check", _Account_CheckPhoneCode0_HTTP_Handler(srv))
 }
 
+func _Account_CreateTestUser0_HTTP_Handler(srv AccountHTTPServer) func(ctx http.Context) error {
+	return func(ctx http.Context) error {
+		var in emptypb.Empty
+		if err := ctx.Bind(&in); err != nil {
+			return err
+		}
+		if err := ctx.BindQuery(&in); err != nil {
+			return err
+		}
+		http.SetOperation(ctx, "/api.account.Account/CreateTestUser")
+		h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
+			return srv.CreateTestUser(ctx, req.(*emptypb.Empty))
+		})
+		out, err := h(ctx, &in)
+		if err != nil {
+			return err
+		}
+		success := &reply.SuccessReply{
+			Code: 0,
+		}
+		if out != nil {
+			success.Data = out
+		}
+		return ctx.Result(200, success)
+	}
+}
+
 func _Account_DebugLogin0_HTTP_Handler(srv AccountHTTPServer) func(ctx http.Context) error {
 	return func(ctx http.Context) error {
 		var in DebugLoginRequest
@@ -152,6 +181,7 @@ func _Account_CheckPhoneCode0_HTTP_Handler(srv AccountHTTPServer) func(ctx http.
 type AccountHTTPClient interface {
 	Authorization(ctx context.Context, req *AuthorizationRequest, opts ...http.CallOption) (rsp *TokenReply, err error)
 	CheckPhoneCode(ctx context.Context, req *CheckPhoneCodeRequest, opts ...http.CallOption) (rsp *emptypb.Empty, err error)
+	CreateTestUser(ctx context.Context, req *emptypb.Empty, opts ...http.CallOption) (rsp *emptypb.Empty, err error)
 	DebugLogin(ctx context.Context, req *DebugLoginRequest, opts ...http.CallOption) (rsp *TokenReply, err error)
 	SendPhoneCode(ctx context.Context, req *SendPhoneCodeRequest, opts ...http.CallOption) (rsp *emptypb.Empty, err error)
 }
@@ -190,6 +220,19 @@ func (c *AccountHTTPClientImpl) CheckPhoneCode(ctx context.Context, in *CheckPho
 	return &out, err
 }
 
+func (c *AccountHTTPClientImpl) CreateTestUser(ctx context.Context, in *emptypb.Empty, opts ...http.CallOption) (*emptypb.Empty, error) {
+	var out emptypb.Empty
+	pattern := "/api/login/create"
+	path := binding.EncodeURL(pattern, in, false)
+	opts = append(opts, http.Operation("/api.account.Account/CreateTestUser"))
+	opts = append(opts, http.PathTemplate(pattern))
+	err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return &out, err
+}
+
 func (c *AccountHTTPClientImpl) DebugLogin(ctx context.Context, in *DebugLoginRequest, opts ...http.CallOption) (*TokenReply, error) {
 	var out TokenReply
 	pattern := "/api/login/debug"

+ 4 - 0
js/api/account/account_http_pb.ts

@@ -3,6 +3,10 @@ import { request } from 'ice';
 import {DebugLoginRequest,TokenReply,AuthorizationRequest,SendPhoneCodeRequest,CheckPhoneCodeRequest,OpenIDRequest,IdentityInfo} from "./account_pb";
 
 const AccountService = {
+  CreateTestUser: async (req?: undefined) => {
+	const res = await request.post('/api/login/create', req);
+    return res.data;
+  },
   DebugLogin: async (req?: DebugLoginRequest) => {
 	const res = await request.post<{ data: TokenReply, code: string, message: string }>('/api/login/debug', req);
     return res.data;