[MM-41956] Unique name error on update (#19600)
* tools updates * Revert "tools updates" This reverts commit 6293297b55803c5a263e200ebd80192899666ae9. * fixing error id for duplicate name on patch endpoint * fixing broken test Co-authored-by: Benjamin Cooke <benjamincooke@Benjamins-MacBook-Pro.local> Co-authored-by: Benjamin Cooke <benjamincooke@Benjamins-MBP.ht.home> Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
@@ -328,7 +328,7 @@ func (s *SqlGroupStore) Update(group *model.Group) (*model.Group, error) {
|
|||||||
WHERE Id=:Id`, group)
|
WHERE Id=:Id`, group)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if IsUniqueConstraintError(err, []string{"Name", "groups_name_key"}) {
|
if IsUniqueConstraintError(err, []string{"Name", "groups_name_key"}) {
|
||||||
return nil, errors.Wrapf(err, "Group with name %s already exists", *group.Name)
|
return nil, store.NewErrUniqueConstraint("Name")
|
||||||
}
|
}
|
||||||
return nil, errors.Wrap(err, "failed to update Group")
|
return nil, errors.Wrap(err, "failed to update Group")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -668,7 +668,7 @@ func testGroupStoreUpdate(t *testing.T, ss store.Store) {
|
|||||||
RemoteId: model.NewString(model.NewId()),
|
RemoteId: model.NewString(model.NewId()),
|
||||||
})
|
})
|
||||||
require.Error(t, err)
|
require.Error(t, err)
|
||||||
require.Contains(t, err.Error(), fmt.Sprintf("Group with name %s already exists", *g1Update.Name))
|
require.Contains(t, err.Error(), "unique constraint: Name")
|
||||||
|
|
||||||
// Cannot update CreateAt
|
// Cannot update CreateAt
|
||||||
someVal := model.GetMillis()
|
someVal := model.GetMillis()
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user