update Order History

This commit is contained in:
aditya.siregar
2024-07-26 22:32:24 +07:00
parent 5ef14f3043
commit 105bda67a3
8 changed files with 30 additions and 35 deletions
+3 -9
View File
@@ -6,6 +6,7 @@ import (
"errors"
"fmt"
"furtuna-be/internal/common/logger"
"furtuna-be/internal/common/mycontext"
order2 "furtuna-be/internal/constants/order"
"furtuna-be/internal/entity"
"furtuna-be/internal/repository"
@@ -297,15 +298,8 @@ func (s *OrderService) updateWalletBalance(ctx context.Context, tx *gorm.DB, par
return err
}
func (s *OrderService) GetAllHistoryOrders(ctx context.Context, tokenString string, req entity.HistoryOrderSearch) ([]*entity.HistoryOrder, int, error) {
claims, err := s.crypt.ParseAndValidateJWT(tokenString)
if err != nil {
logger.ContextLogger(ctx).Error("error when get data token", zap.Error(err))
return nil, 0, err
}
historyOrders, total, err := s.repo.GetAllHystoryOrders(ctx, *claims, req)
func (s *OrderService) GetAllHistoryOrders(ctx mycontext.Context, req entity.HistoryOrderSearch) ([]*entity.HistoryOrder, int, error) {
historyOrders, total, err := s.repo.GetAllHystoryOrders(ctx, req)
if err != nil {
logger.ContextLogger(ctx).Error("error when get all history orders", zap.Error(err))
return nil, 0, err
+3 -3
View File
@@ -42,8 +42,8 @@ func NewServiceManagerImpl(cfg *config.Config, repo *repository.RepoManagerImpl)
BranchSvc: branch.NewBranchService(repo.Branch),
StudioSvc: studio.NewStudioService(repo.Studio),
ProductSvc: product.NewProductService(repo.Product),
OrderSvc: order.NewOrderService(repo.Order, repo.Product, repo.Crypto, repo.Midtrans, repo.Payment, repo.Trx, repo.Wallet),
OSSSvc: oss.NewOSSService(repo.OSS),
OrderSvc: order.NewOrderService(repo.Order, repo.Product, repo.Crypto, repo.Midtrans, repo.Payment, repo.Trx, repo.Wallet),
OSSSvc: oss.NewOSSService(repo.OSS),
PartnerSvc: partner.NewPartnerService(
repo.Partner, users.NewUserService(repo.User, repo.Branch), repo.Trx, repo.Wallet),
SiteSvc: site.NewSiteService(repo.Site),
@@ -101,7 +101,7 @@ type Order interface {
CreateOrder(ctx context.Context, req *entity.OrderRequest) (*entity.OrderResponse, error)
Execute(ctx context.Context, req *entity.OrderExecuteRequest) (*entity.ExecuteOrderResponse, error)
ProcessCallback(ctx context.Context, req *entity.CallbackRequest) error
GetAllHistoryOrders(ctx context.Context, tokenString string, req entity.HistoryOrderSearch) ([]*entity.HistoryOrder, int, error)
GetAllHistoryOrders(ctx mycontext.Context, req entity.HistoryOrderSearch) ([]*entity.HistoryOrder, int, error)
}
type OSSService interface {