MSP-5223 implement handler config/config/update_config_name

This commit is contained in:
Кузнецов Иван Александрович committed 2025-04-14 11:50:25 +03:00
1 parent d0b55947c5
commit a7b203bcd0
6 files changed
+76 -5

No files matched your search

+17
View File
@@ -20,6 +20,7 @@ type ConfigService interface {
GetConfigById(ctx context.Context, configId string) (*domain.Config, error)
MarkConfigAsActive(ctx context.Context, configId string) error
DeleteConfig(ctx context.Context, id string) error
UpdateConfigName(ctx context.Context, req domain.UpdateConfigNameRequest) error
}
type Config struct {
@@ -234,3 +235,19 @@ func (c Config) DeleteConfigs(ctx context.Context, identities []string) (*domain
}, nil
}
}
func (c Config) UpdateConfigName(ctx context.Context, req domain.UpdateConfigNameRequest) error {
err := c.service.UpdateConfigName(ctx, req)
switch {
case errors.Is(err, entity.ErrConfigNotFound):
return apierrors.NewBusinessError(
domain.ErrorCodeConfigNotFound,
"config not found",
err,
)
case err != nil:
return apierrors.NewInternalServiceError(err)
default:
return nil
}
}