+15
-4
@@ -28,7 +28,6 @@ func (s *Server) Ping(context.Context, *proto.PingReq) (*proto.PingRsp, error) {
|
||||
return &proto.PingRsp{}, nil
|
||||
}
|
||||
|
||||
// AddUser implements proto.SmmCoreServer.
|
||||
func (s *Server) AddUser(ctx context.Context, req *proto.AddUserReq) (*proto.User, error) {
|
||||
user, err := s.userService.AddUser(
|
||||
ctx,
|
||||
@@ -46,9 +45,21 @@ func (s *Server) AddUser(ctx context.Context, req *proto.AddUserReq) (*proto.Use
|
||||
}, nil
|
||||
}
|
||||
|
||||
// Login implements proto.SmmCoreServer.
|
||||
func (s *Server) Login(context.Context, *proto.LoginReq) (*proto.User, error) {
|
||||
panic("unimplemented")
|
||||
func (s *Server) Login(ctx context.Context, req *proto.LoginReq) (*proto.User, error) {
|
||||
user, err := s.userService.Login(
|
||||
ctx,
|
||||
&user.UserEntity{
|
||||
Username: req.Username,
|
||||
Password: req.Password,
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &proto.User{
|
||||
Id: int32(user.Id),
|
||||
Username: req.Username,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// AddBudget implements proto.SmmCoreServer.
|
||||
|
||||
Reference in New Issue
Block a user