mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-08 16:46:37 +08:00
feat(contracts): add TableName and gorm serializer tags to DTOs
This commit is contained in:
@@ -29,6 +29,7 @@ func (PublicConfigAdapter) PublicConfig(ctx context.Context) (map[string]string,
|
||||
// SystemConfigServiceImpl implements contracts.SystemConfigService.
|
||||
type SystemConfigServiceImpl struct{}
|
||||
|
||||
// GetByKey retrieves a system config by its unique key.
|
||||
func (SystemConfigServiceImpl) GetByKey(ctx context.Context, key string) (contracts.SystemConfigDTO, error) {
|
||||
cfg, err := repository.GetSystemConfigByKey(ctx, key)
|
||||
if err != nil {
|
||||
@@ -37,6 +38,7 @@ func (SystemConfigServiceImpl) GetByKey(ctx context.Context, key string) (contra
|
||||
return toSystemConfigDTO(cfg), nil
|
||||
}
|
||||
|
||||
// ListByKeys retrieves multiple system configs by their keys.
|
||||
func (SystemConfigServiceImpl) ListByKeys(ctx context.Context, keys []string) (map[string]contracts.SystemConfigDTO, error) {
|
||||
cfgs, err := repository.ListSystemConfigsByKeys(ctx, keys)
|
||||
if err != nil {
|
||||
@@ -49,6 +51,7 @@ func (SystemConfigServiceImpl) ListByKeys(ctx context.Context, keys []string) (m
|
||||
return res, nil
|
||||
}
|
||||
|
||||
// ListVisible returns all user-visible system configs.
|
||||
func (SystemConfigServiceImpl) ListVisible(ctx context.Context) ([]contracts.SystemConfigDTO, error) {
|
||||
cfgs, err := repository.ListVisibleSystemConfigs(ctx)
|
||||
if err != nil {
|
||||
@@ -61,6 +64,7 @@ func (SystemConfigServiceImpl) ListVisible(ctx context.Context) ([]contracts.Sys
|
||||
return res, nil
|
||||
}
|
||||
|
||||
// ListByType returns all system configs belonging to a specific configuration type.
|
||||
func (SystemConfigServiceImpl) ListByType(ctx context.Context, configType string) ([]contracts.SystemConfigDTO, error) {
|
||||
cfgs, err := repository.ListAdminSystemConfigs(ctx, configType)
|
||||
if err != nil {
|
||||
@@ -73,22 +77,27 @@ func (SystemConfigServiceImpl) ListByType(ctx context.Context, configType string
|
||||
return res, nil
|
||||
}
|
||||
|
||||
// GetIntByKey retrieves an integer system config value.
|
||||
func (SystemConfigServiceImpl) GetIntByKey(ctx context.Context, key string) (int, error) {
|
||||
return repository.GetIntByKey(ctx, key)
|
||||
}
|
||||
|
||||
// GetBoolByKey retrieves a boolean system config value.
|
||||
func (SystemConfigServiceImpl) GetBoolByKey(ctx context.Context, key string) (bool, error) {
|
||||
return repository.GetBoolByKey(ctx, key)
|
||||
}
|
||||
|
||||
// SaveOrUpdate persists or updates a system config key-value pair.
|
||||
func (SystemConfigServiceImpl) SaveOrUpdate(ctx context.Context, key, value string) error {
|
||||
return repository.SaveOrUpdateSystemConfig(ctx, key, value)
|
||||
}
|
||||
|
||||
// InvalidateCache evicts the cache entry for the specified key.
|
||||
func (SystemConfigServiceImpl) InvalidateCache(ctx context.Context, key string) error {
|
||||
return repository.InvalidateSystemConfigCache(ctx, key)
|
||||
}
|
||||
|
||||
// InvalidateAllCaches purges all system configuration cache entries.
|
||||
func (SystemConfigServiceImpl) InvalidateAllCaches(ctx context.Context) error {
|
||||
return repository.InvalidateAllSystemConfigCaches(ctx)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user