Add Transaction
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
"furtuna-be/internal/services/product"
|
||||
site "furtuna-be/internal/services/sites"
|
||||
"furtuna-be/internal/services/studio"
|
||||
"furtuna-be/internal/services/transaction"
|
||||
"furtuna-be/internal/services/users"
|
||||
|
||||
"gorm.io/gorm"
|
||||
@@ -23,17 +24,18 @@ import (
|
||||
)
|
||||
|
||||
type ServiceManagerImpl struct {
|
||||
AuthSvc Auth
|
||||
EventSvc Event
|
||||
UserSvc User
|
||||
BranchSvc Branch
|
||||
StudioSvc Studio
|
||||
ProductSvc Product
|
||||
OrderSvc Order
|
||||
OSSSvc OSSService
|
||||
PartnerSvc Partner
|
||||
SiteSvc Site
|
||||
LicenseSvc License
|
||||
AuthSvc Auth
|
||||
EventSvc Event
|
||||
UserSvc User
|
||||
BranchSvc Branch
|
||||
StudioSvc Studio
|
||||
ProductSvc Product
|
||||
OrderSvc Order
|
||||
OSSSvc OSSService
|
||||
PartnerSvc Partner
|
||||
SiteSvc Site
|
||||
LicenseSvc License
|
||||
Transaction Transaction
|
||||
}
|
||||
|
||||
func NewServiceManagerImpl(cfg *config.Config, repo *repository.RepoManagerImpl) *ServiceManagerImpl {
|
||||
@@ -48,8 +50,9 @@ func NewServiceManagerImpl(cfg *config.Config, repo *repository.RepoManagerImpl)
|
||||
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),
|
||||
LicenseSvc: service.NewLicenseService(repo.License),
|
||||
SiteSvc: site.NewSiteService(repo.Site),
|
||||
LicenseSvc: service.NewLicenseService(repo.License),
|
||||
Transaction: transaction.New(repo.Transaction),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,3 +140,7 @@ type License interface {
|
||||
GetByID(ctx context.Context, id string) (*entity.License, error)
|
||||
GetAll(ctx context.Context, limit, offset int, status string) ([]*entity.LicenseGetAll, int64, error)
|
||||
}
|
||||
|
||||
type Transaction interface {
|
||||
GetTransactionList(ctx mycontext.Context, req entity.TransactionSearch) ([]*entity.TransactionList, int, error)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package transaction
|
||||
|
||||
import (
|
||||
"furtuna-be/internal/common/logger"
|
||||
"furtuna-be/internal/common/mycontext"
|
||||
"furtuna-be/internal/entity"
|
||||
"furtuna-be/internal/repository"
|
||||
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
type TransactionService struct {
|
||||
repo repository.TransactionRepository
|
||||
}
|
||||
|
||||
func New(repo repository.TransactionRepository) *TransactionService {
|
||||
return &TransactionService{
|
||||
repo: repo,
|
||||
}
|
||||
}
|
||||
|
||||
func (s *TransactionService) GetTransactionList(ctx mycontext.Context,
|
||||
req entity.TransactionSearch) ([]*entity.TransactionList, int, error) {
|
||||
transactions, total, err := s.repo.GetTransactionList(ctx, req)
|
||||
if err != nil {
|
||||
logger.ContextLogger(ctx).Error("error when get all products", zap.Error(err))
|
||||
return nil, 0, err
|
||||
}
|
||||
|
||||
return transactions, total, nil
|
||||
}
|
||||
Reference in New Issue
Block a user