40 lines
1.1 KiB
Go
40 lines
1.1 KiB
Go
package ticket
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/SamuelTariku/FortuneBet-Backend/internal/domain"
|
|
)
|
|
|
|
type Service struct {
|
|
ticketStore TicketStore
|
|
}
|
|
|
|
func NewService(ticketStore TicketStore) *Service {
|
|
return &Service{
|
|
ticketStore: ticketStore,
|
|
}
|
|
}
|
|
|
|
func (s *Service) CreateTicket(ctx context.Context, ticket domain.CreateTicket) (domain.Ticket, error) {
|
|
return s.ticketStore.CreateTicket(ctx, ticket)
|
|
}
|
|
|
|
func (s *Service) CreateTicketOutcome(ctx context.Context, outcomes []domain.CreateTicketOutcome) (int64, error) {
|
|
return s.ticketStore.CreateTicketOutcome(ctx, outcomes)
|
|
}
|
|
|
|
func (s *Service) GetTicketByID(ctx context.Context, id int64) (domain.GetTicket, error) {
|
|
return s.ticketStore.GetTicketByID(ctx, id)
|
|
}
|
|
func (s *Service) GetAllTickets(ctx context.Context) ([]domain.GetTicket, error) {
|
|
return s.ticketStore.GetAllTickets(ctx)
|
|
}
|
|
|
|
func (s *Service) UpdateTicketOutcomeStatus(ctx context.Context, id int64, status domain.OutcomeStatus) error {
|
|
return s.ticketStore.UpdateTicketOutcomeStatus(ctx, id, status)
|
|
}
|
|
func (s *Service) DeleteTicket(ctx context.Context, id int64) error {
|
|
return s.ticketStore.DeleteTicket(ctx, id)
|
|
}
|