boweniac 2 weeks ago
parent
commit
46a32edaaa
1 changed files with 8 additions and 6 deletions
  1. 8 6
      internal/logic/contact/update_contact_logic.go

+ 8 - 6
internal/logic/contact/update_contact_logic.go

@@ -98,12 +98,14 @@ func UpdateContactFields(ctx context.Context, tx *ent.Tx, contact_id uint64, fie
 				if len(field.Value) == 0 {
 					field.Value = []string{""}
 				}
-				_, err := tx.ContactField.UpdateOneID(f.ID).
-					SetValue(field.Value).
-					Save(ctx)
-				if err != nil {
-					return err
-				}
+			} else {
+				field.Value = []string{""}
+			}
+			_, err := tx.ContactField.UpdateOneID(f.ID).
+				SetValue(field.Value).
+				Save(ctx)
+			if err != nil {
+				return err
 			}
 		}
 	}