From 5bdb64729ac3b4877615661d0ae6449104951cfb Mon Sep 17 00:00:00 2001 From: Seongmin Lee Date: Thu, 11 Dec 2025 17:07:09 +0900 Subject: [PATCH] appview/db: receive `fromCid` in `putReferences` This will allow tracking atproto records by their CIDs Signed-off-by: Seongmin Lee --- appview/db/comments.go | 2 +- appview/db/issues.go | 4 ++-- appview/db/pulls.go | 2 +- appview/db/reference.go | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/appview/db/comments.go b/appview/db/comments.go index 3cd9cd18..e04150e1 100644 --- a/appview/db/comments.go +++ b/appview/db/comments.go @@ -62,7 +62,7 @@ func PutComment(tx *sql.Tx, c *models.Comment) error { return err } - if err := putReferences(tx, c.AtUri(), c.References); err != nil { + if err := putReferences(tx, c.AtUri(), nil, c.References); err != nil { return fmt.Errorf("put reference_links: %w", err) } diff --git a/appview/db/issues.go b/appview/db/issues.go index 09e96fec..b39872b9 100644 --- a/appview/db/issues.go +++ b/appview/db/issues.go @@ -76,7 +76,7 @@ func createNewIssue(tx *sql.Tx, issue *models.Issue) error { return fmt.Errorf("scan row: %w", err) } - if err := putReferences(tx, issue.AtUri(), issue.References); err != nil { + if err := putReferences(tx, issue.AtUri(), nil, issue.References); err != nil { return fmt.Errorf("put reference_links: %w", err) } return nil @@ -93,7 +93,7 @@ func updateIssue(tx *sql.Tx, issue *models.Issue) error { return err } - if err := putReferences(tx, issue.AtUri(), issue.References); err != nil { + if err := putReferences(tx, issue.AtUri(), nil, issue.References); err != nil { return fmt.Errorf("put reference_links: %w", err) } return nil diff --git a/appview/db/pulls.go b/appview/db/pulls.go index fa811d00..d94cbe51 100644 --- a/appview/db/pulls.go +++ b/appview/db/pulls.go @@ -99,7 +99,7 @@ func NewPull(tx *sql.Tx, pull *models.Pull) error { return err } - if err := putReferences(tx, pull.AtUri(), pull.References); err != nil { + if err := putReferences(tx, pull.AtUri(), nil, pull.References); err != nil { return fmt.Errorf("put reference_links: %w", err) } diff --git a/appview/db/reference.go b/appview/db/reference.go index 15c5353e..7341c649 100644 --- a/appview/db/reference.go +++ b/appview/db/reference.go @@ -160,7 +160,7 @@ func findPullReferences(e Execer, refLinks []models.ReferenceLink) ([]syntax.ATU return uris, nil } -func putReferences(tx *sql.Tx, fromAt syntax.ATURI, references []syntax.ATURI) error { +func putReferences(tx *sql.Tx, fromAt syntax.ATURI, fromCid *syntax.CID, references []syntax.ATURI) error { err := deleteReferences(tx, fromAt) if err != nil { return fmt.Errorf("delete old reference_links: %w", err) -- 2.51.2