Add Transaction
This commit is contained in:
@@ -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