This commit is contained in:
+16
-14
@@ -36,20 +36,6 @@ func (s *Server) Ping(context.Context, *proto.PingReq) (*proto.PingRsp, error) {
|
||||
return &proto.PingRsp{}, nil
|
||||
}
|
||||
|
||||
func (s *Server) AddUser(ctx context.Context, req *proto.AddUserReq) (*proto.User, error) {
|
||||
user, err := s.userService.AddUser(
|
||||
ctx,
|
||||
&user.UserEntity{
|
||||
Username: req.Username,
|
||||
Password: req.Password,
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return mapUser(user), nil
|
||||
}
|
||||
|
||||
func (s *Server) Login(ctx context.Context, req *proto.LoginReq) (*proto.User, error) {
|
||||
user, err := s.userService.Login(
|
||||
ctx,
|
||||
@@ -148,6 +134,22 @@ func (s *Server) AddWaste(ctx context.Context, req *proto.AddWasteReq) (*proto.W
|
||||
Price: int(req.Price),
|
||||
Amount: req.Amount,
|
||||
CategoryId: int(req.CategoryId),
|
||||
BudgetId: int(req.BudgetId),
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return mapWaste(waste), nil
|
||||
}
|
||||
|
||||
func (s *Server) AddWasteByText(ctx context.Context, req *proto.AddWasteTextReq) (*proto.Waste, error) {
|
||||
waste, err := s.wasteService.AddWasteByText(
|
||||
ctx,
|
||||
&waste.WasteTextEntity{
|
||||
Text: req.Text,
|
||||
CategoryId: int(req.CategoryId),
|
||||
BudgetId: int(req.BudgetId),
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user