add text waste route
continuous-integration/drone/push Build is failing

This commit is contained in:
2024-11-28 06:43:05 +07:00
parent 26ca649e8e
commit 0ed38b7cc0
15 changed files with 744 additions and 430 deletions
+16 -14
View File
@@ -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 {