MSP-5223 UpdateConfigNameRequest change field OldConfigName -> ConfidId + change ConfigVersion.CreatedAt actualCfg.CreatedAt -> actual.UpdatedAt
This commit is contained in:
1 parent
4214bd3f20
commit
a51aae9b69
5 files changed
+8
-8
No files matched your search
@@ -242,7 +242,7 @@ func (c Config) DeleteConfigs(ctx context.Context, identities []string) (*domain
|
||||
// @Tags Конфигурация
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.UpdateConfigNameRequest true "старое и новое название конфигурации"
|
||||
// @Param body body domain.UpdateConfigNameRequest true "id конфигурации и новое название"
|
||||
// @Success 200
|
||||
// @Failure 400 {object} apierrors.Error "`errorCode: 2002` - конфиг не найден<br/>"
|
||||
// @Failure 500 {object} apierrors.Error
|
||||
|
||||
+4
-4
@@ -176,13 +176,13 @@ definitions:
|
||||
type: object
|
||||
domain.UpdateConfigNameRequest:
|
||||
properties:
|
||||
configId:
|
||||
type: string
|
||||
newConfigName:
|
||||
type: string
|
||||
oldConfigName:
|
||||
type: string
|
||||
required:
|
||||
- configId
|
||||
- newConfigName
|
||||
- oldConfigName
|
||||
type: object
|
||||
domain.UpdateVariableRequest:
|
||||
properties:
|
||||
@@ -515,7 +515,7 @@ paths:
|
||||
description: Изменеяет название конфигурации без повышения версии и без рассылки
|
||||
события
|
||||
parameters:
|
||||
- description: старое и новое название конфигурации
|
||||
- description: id конфигурации и новое название
|
||||
in: body
|
||||
name: body
|
||||
required: true
|
||||
|
||||
+1
-1
@@ -26,6 +26,6 @@ type CreateUpdateConfigRequest struct {
|
||||
}
|
||||
|
||||
type UpdateConfigNameRequest struct {
|
||||
OldConfigName string `validate:"required"`
|
||||
ConfigId string `validate:"required"`
|
||||
NewConfigName string `validate:"required"`
|
||||
}
|
||||
@@ -207,7 +207,7 @@ func (r Config) UpdateConfigName(ctx context.Context, req domain.UpdateConfigNam
|
||||
Set("name", req.NewConfigName).
|
||||
Set("updated_at", squirrel.Expr("unixepoch()")).
|
||||
Where(squirrel.Eq{
|
||||
"name": req.OldConfigName,
|
||||
"id": req.ConfigId,
|
||||
}).
|
||||
ToSql()
|
||||
if err != nil {
|
||||
|
||||
@@ -60,7 +60,7 @@ func (s ConfigHistory) GetAllVersions(ctx context.Context, configId string) ([]d
|
||||
ConfigId: actualCfg.Id,
|
||||
ConfigVersion: actualCfg.Version,
|
||||
Data: actualCfg.Data,
|
||||
CreatedAt: time.Time(actualCfg.CreatedAt),
|
||||
CreatedAt: time.Time(actualCfg.UpdatedAt),
|
||||
})
|
||||
|
||||
for _, version := range versions {
|
||||
|
||||
Reference in new issue
Block a user