32 lines
952 B
Go
32 lines
952 B
Go
package transaction
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/SamuelTariku/FortuneBet-Backend/internal/domain"
|
|
)
|
|
|
|
type Service struct {
|
|
transactionStore TransactionStore
|
|
}
|
|
|
|
func NewService(transactionStore TransactionStore) *Service {
|
|
return &Service{
|
|
transactionStore: transactionStore,
|
|
}
|
|
}
|
|
|
|
func (s *Service) CreateTransaction(ctx context.Context, transaction domain.CreateTransaction) (domain.Transaction, error) {
|
|
return s.transactionStore.CreateTransaction(ctx, transaction)
|
|
}
|
|
func (s *Service) GetTransactionByID(ctx context.Context, id int64) (domain.Transaction, error) {
|
|
return s.transactionStore.GetTransactionByID(ctx, id)
|
|
}
|
|
func (s *Service) GetAllTransactions(ctx context.Context) ([]domain.Transaction, error) {
|
|
return s.transactionStore.GetAllTransactions(ctx)
|
|
}
|
|
func (s *Service) UpdateTransactionVerified(ctx context.Context, id int64, verified bool) error {
|
|
|
|
return s.transactionStore.UpdateTransactionVerified(ctx, id, verified)
|
|
}
|