32 lines
755 B
Go
32 lines
755 B
Go
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
|
|
}
|