Yōten: A social tracker for your language learning journey built on the atproto.

feat: add notifications to db on ingest

brookjeynes.dev 11daa1aa 63e15018

verified
+13
+13
internal/consumer/ingester.go
··· 391 391 tx.Rollback() 392 392 return fmt.Errorf("failed to upsert activity def record: %w", err) 393 393 } 394 + 395 + subjectUri := fmt.Sprintf("at://%s/%s/%s", did, yoten.GraphFollowNSID, e.Commit.RKey) 396 + err = db.CreateNotification(tx, subjectDid, did, subjectUri, db.NotificationTypeFollow) 397 + if err != nil { 398 + log.Println("failed to create notification record:", err) 399 + } 400 + 394 401 return tx.Commit() 395 402 case models.CommitOperationDelete: 396 403 log.Println("deleting follow from pds request") ··· 462 469 tx.Rollback() 463 470 return fmt.Errorf("failed to upsert activity def record: %w", err) 464 471 } 472 + 473 + err = db.CreateNotification(tx, subjectDid.String(), did, subject.String(), db.NotificationTypeReaction) 474 + if err != nil { 475 + log.Println("failed to create notification record:", err) 476 + } 477 + 465 478 return tx.Commit() 466 479 case models.CommitOperationDelete: 467 480 log.Println("deleting reaction from pds request")