feat(crm): dedupe duplicates, fix deal titles, and add cleanup CLI

Merge duplicate companies/persons/deals by name, remove duplicate contact
info and opportunity members, and rename malformed " @ Company" titles.
Applications sync now avoids empty-position titles and duplicate members.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-24 12:34:14 +01:00
co-authored by Cursor
parent e03fd62200
commit c77519fac5
21 changed files with 1832 additions and 46 deletions
+30
View File
@@ -0,0 +1,30 @@
package applications
import (
"testing"
onlyoffice "github.com/eslider/go-onlyoffice"
)
func TestDealTitleForApplication(t *testing.T) {
if got := onlyoffice.DealTitleForApplication("", "711media"); got != "711media" {
t.Fatalf("got %q", got)
}
if got := onlyoffice.DealTitleForApplication("Dev", "Acme"); got != "Dev @ Acme" {
t.Fatalf("got %q", got)
}
}
func TestHasContactInfoHelper(t *testing.T) {
contact := map[string]any{
"commonData": []any{
map[string]any{"infoType": "Email", "data": "a@b.com"},
},
}
if !onlyoffice.HasContactInfo(contact, "Email", "a@b.com") {
t.Fatal("expected match")
}
if onlyoffice.HasContactInfo(contact, "Email", "other@b.com") {
t.Fatal("unexpected match")
}
}