fix(valid config status after update)
This commit is contained in:
1 parent
f752770788
commit
73515e5179
6 files changed
+111
-48
No files matched your search
@@ -87,8 +87,6 @@ func (c *commonConfig) DeleteConfigs(req domain.ConfigIdRequest) (*domain.Delete
|
||||
return &response, nil
|
||||
}
|
||||
|
||||
type CompiledConfig map[string]interface{}
|
||||
|
||||
// CompileConfigs godoc
|
||||
// @Summary Метод компиляции итоговой конфигурации для модулей
|
||||
// @Description Возвращает скомпилированный объект конфигурации
|
||||
@@ -96,9 +94,9 @@ type CompiledConfig map[string]interface{}
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.CompileConfigsRequest true "перечисление идентификаторов общей конфигурации и исхдных конфиг"
|
||||
// @Success 200 {object} CompiledConfig
|
||||
// @Success 200 {object} domain.CompiledConfigResponse
|
||||
// @Router /common_config/compile [POST]
|
||||
func (c *commonConfig) CompileConfigs(req domain.CompileConfigsRequest) CompiledConfig {
|
||||
func (c *commonConfig) CompileConfigs(req domain.CompileConfigsRequest) domain.CompiledConfigResponse {
|
||||
var result map[string]interface{}
|
||||
c.rstore.VisitReadonlyState(func(state state.ReadonlyState) {
|
||||
result = service.ConfigService.CompileConfig(req.Data, state, req.CommonConfigsIdList...)
|
||||
|
||||
@@ -49,13 +49,13 @@ func (c *config) GetActiveConfigByModuleName(request domain.GetByModuleNameReque
|
||||
// @Tags Конфигурация
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body entity.Config true "объект для сохранения"
|
||||
// @Success 200 {object} entity.Config
|
||||
// @Param body body domain.CreateUpdateConfigRequest true "объект для сохранения"
|
||||
// @Success 200 {object} domain.ConfigModuleInfo
|
||||
// @Failure 404 {object} structure.GrpcError "если конфигурация не найдена"
|
||||
// @Failure 500 {object} structure.GrpcError
|
||||
// @Router /config/create_update_config [POST]
|
||||
func (c *config) CreateUpdateConfig(config domain.CreateUpdateConfigRequest) (*entity.Config, error) {
|
||||
var response domain.CreateUpdateConfigInvalidResponse
|
||||
func (c *config) CreateUpdateConfig(config domain.CreateUpdateConfigRequest) (*domain.ConfigModuleInfo, error) {
|
||||
var response domain.CreateUpdateConfigResponse
|
||||
now := state.GenerateDate()
|
||||
config.CreatedAt = now
|
||||
config.UpdatedAt = now
|
||||
@@ -71,10 +71,10 @@ func (c *config) CreateUpdateConfig(config domain.CreateUpdateConfigRequest) (*e
|
||||
err := PerformSyncApplyWithError(command, "UpsertConfigCommand", &response)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
} else if response.Valid {
|
||||
} else if response.Config != nil {
|
||||
return response.Config, nil
|
||||
} else {
|
||||
return nil, utils.CreateValidationErrorDetails(codes.InvalidArgument, utils.ValidationError, response.Details)
|
||||
return nil, utils.CreateValidationErrorDetails(codes.InvalidArgument, utils.ValidationError, response.ErrorDetails)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user