34 lines
1.1 KiB
Go
34 lines
1.1 KiB
Go
package user
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/SamuelTariku/FortuneBet-Backend/internal/domain"
|
|
)
|
|
|
|
type Service struct {
|
|
userStore UserStore
|
|
}
|
|
|
|
func NewService(userStore UserStore) *Service {
|
|
return &Service{
|
|
userStore: userStore,
|
|
}
|
|
}
|
|
|
|
func (s *Service) CreateUser(ctx context.Context, firstName, lastName, email, phoneNumber, password, role string, verified bool) (domain.User, error) {
|
|
return s.userStore.CreateUser(ctx, firstName, lastName, email, phoneNumber, password, role, verified)
|
|
}
|
|
func (s *Service) GetUserByID(ctx context.Context, id int64) (domain.User, error) {
|
|
return s.userStore.GetUserByID(ctx, id)
|
|
}
|
|
func (s *Service) GetAllUsers(ctx context.Context) ([]domain.User, error) {
|
|
return s.userStore.GetAllUsers(ctx)
|
|
}
|
|
func (s *Service) UpdateUser(ctx context.Context, id int64, firstName, lastName, email, phoneNumber, password, role string, verified bool) error {
|
|
return s.userStore.UpdateUser(ctx, id, firstName, lastName, email, phoneNumber, password, role, verified)
|
|
}
|
|
func (s *Service) DeleteUser(ctx context.Context, id int64) error {
|
|
return s.userStore.DeleteUser(ctx, id)
|
|
}
|