remove record rule check (#1090)

Co-authored-by: ziv <xiaozheng@tuya.com>
This commit is contained in:
xiaoziv 2022-08-06 18:15:04 +08:00 committed by GitHub
parent 58e777eb00
commit ea46401db2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 17 deletions

View File

@ -83,14 +83,15 @@ func (re *RecordingRule) Add() error {
return err
}
exists, err := RecordingRuleExists(0, re.GroupId, re.Cluster, re.Name)
if err != nil {
return err
}
if exists {
return errors.New("RecordingRule already exists")
}
// 由于实际场景中会出现name重复的recording rule所以不需要检查重复
//exists, err := RecordingRuleExists(0, re.GroupId, re.Cluster, re.Name)
//if err != nil {
// return err
//}
//
//if exists {
// return errors.New("RecordingRule already exists")
//}
now := time.Now().Unix()
re.CreateAt = now
@ -100,15 +101,16 @@ func (re *RecordingRule) Add() error {
}
func (re *RecordingRule) Update(ref RecordingRule) error {
if re.Name != ref.Name {
exists, err := RecordingRuleExists(re.Id, re.GroupId, re.Cluster, ref.Name)
if err != nil {
return err
}
if exists {
return errors.New("RecordingRule already exists")
}
}
// 由于实际场景中会出现name重复的recording rule所以不需要检查重复
//if re.Name != ref.Name {
// exists, err := RecordingRuleExists(re.Id, re.GroupId, re.Cluster, ref.Name)
// if err != nil {
// return err
// }
// if exists {
// return errors.New("RecordingRule already exists")
// }
//}
ref.FE2DB()
ref.Id = re.Id