64 lines
2.3 KiB
Go
64 lines
2.3 KiB
Go
package settings
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/SamuelTariku/FortuneBet-Backend/internal/domain"
|
|
)
|
|
|
|
type Service struct {
|
|
settingStore SettingStore
|
|
}
|
|
|
|
func NewService(settingStore SettingStore) *Service {
|
|
return &Service{
|
|
settingStore: settingStore,
|
|
}
|
|
}
|
|
|
|
func (s *Service) GetGlobalSettingList(ctx context.Context) (domain.SettingList, error) {
|
|
return s.settingStore.GetGlobalSettingList(ctx)
|
|
}
|
|
|
|
func (s *Service) GetGlobalSettings(ctx context.Context) ([]domain.Setting, error) {
|
|
return s.settingStore.GetGlobalSettings(ctx)
|
|
}
|
|
|
|
func (s *Service) GetGlobalSetting(ctx context.Context, key string) (domain.Setting, error) {
|
|
return s.settingStore.GetGlobalSetting(ctx, key)
|
|
}
|
|
func (s *Service) UpdateGlobalSetting(ctx context.Context, key, value string) error {
|
|
return s.settingStore.UpdateGlobalSetting(ctx, key, value)
|
|
}
|
|
|
|
func (s *Service) UpdateGlobalSettingList(ctx context.Context, settingList domain.ValidSettingList) error {
|
|
return s.settingStore.UpdateGlobalSettingList(ctx, settingList)
|
|
}
|
|
|
|
func (s *Service) InsertCompanySetting(ctx context.Context, key, value string, companyID int64) error {
|
|
return s.settingStore.InsertCompanySetting(ctx, key, value, companyID)
|
|
}
|
|
func (s *Service) InsertCompanySettingList(ctx context.Context, settingList domain.ValidSettingList, companyID int64) error {
|
|
return s.settingStore.InsertCompanySettingList(ctx, settingList, companyID)
|
|
}
|
|
func (s *Service) GetAllCompanySettings(ctx context.Context) ([]domain.CompanySetting, error) {
|
|
return s.settingStore.GetAllCompanySettings(ctx)
|
|
}
|
|
func (s *Service) GetCompanySettingsByKey(ctx context.Context, key string) ([]domain.CompanySetting, error) {
|
|
return s.settingStore.GetCompanySettingsByKey(ctx, key)
|
|
}
|
|
func (s *Service) GetOverrideSettings(ctx context.Context, companyID int64) ([]domain.Setting, error) {
|
|
return s.settingStore.GetOverrideSettings(ctx, companyID)
|
|
}
|
|
func (s *Service) GetOverrideSettingsList(ctx context.Context, companyID int64) (domain.SettingList, error) {
|
|
return s.settingStore.GetOverrideSettingsList(ctx, companyID)
|
|
}
|
|
|
|
func (s *Service) DeleteCompanySetting(ctx context.Context, companyID int64, key string) error {
|
|
return s.settingStore.DeleteCompanySetting(ctx, companyID, key)
|
|
}
|
|
|
|
func (s *Service) DeleteAllCompanySetting(ctx context.Context, companyID int64) error {
|
|
return s.settingStore.DeleteAllCompanySetting(ctx, companyID)
|
|
}
|