From 1adb9a472f6483019d3de9dbd09b22781b6feaea Mon Sep 17 00:00:00 2001 From: Brittany Ellich Date: Mon, 1 Jun 2026 08:03:33 -0700 Subject: [PATCH] refactor(connection): Put reuses buildConnectionValue (DRY) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace the inline map-building block in Put with a call to the buildConnectionValue helper, eliminating the duplication flagged in code review. Normalization of rec.ConnectedAt (zero → now) is preserved before the helper call. Co-Authored-By: Claude Opus 4.8 --- internal/connection/connection.go | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/internal/connection/connection.go b/internal/connection/connection.go index 679d3f9..a7146d8 100644 --- a/internal/connection/connection.go +++ b/internal/connection/connection.go @@ -80,14 +80,7 @@ func Put(ctx context.Context, sess *oauth.ClientSession, db *sql.DB, rec Record) rec.ConnectedAt = time.Now().UTC() } - value := map[string]any{ - "$type": NSID, - "with": rec.With.String(), - "connectedAt": rec.ConnectedAt.UTC().Format(time.RFC3339), - } - if rec.EventURI != "" { - value["event"] = rec.EventURI - } + value := buildConnectionValue(rec.With, rec.ConnectedAt, rec.EventURI) input := map[string]any{ "repo": sess.Data.AccountDID.String(), -- 2.51.2