···582 if err != nil {
583 return fmt.Errorf("failed to parse study session at-uri: %w", err)
584 }
0000585586 body := record.Body
587- if len(body) == 0 {
588 return fmt.Errorf("invalid body: length cannot be 0")
589 }
590···619 tx.Rollback()
620 return fmt.Errorf("failed to upsert comment record: %w", err)
621 }
000000622 return tx.Commit()
623 case models.CommitOperationDelete:
624 log.Println("deleting comment from pds request")
···582 if err != nil {
583 return fmt.Errorf("failed to parse study session at-uri: %w", err)
584 }
585+ subjectDid, err := subjectUri.Authority().AsDID()
586+ if err != nil {
587+ return fmt.Errorf("failed to identify subject did: %w", err)
588+ }
589590 body := record.Body
591+ if len(strings.TrimSpace(body)) == 0 {
592 return fmt.Errorf("invalid body: length cannot be 0")
593 }
594···623 tx.Rollback()
624 return fmt.Errorf("failed to upsert comment record: %w", err)
625 }
626+627+ err = db.CreateNotification(tx, subjectDid.String(), did, subjectUri.String(), db.NotificationTypeComment)
628+ if err != nil {
629+ log.Println("failed to create notification record:", err)
630+ }
631+632 return tx.Commit()
633 case models.CommitOperationDelete:
634 log.Println("deleting comment from pds request")
+1-1
internal/db/db.go
···193 subject_uri text not null,
194195 state text not null default 'unread' check(state in ('unread', 'read')),
196- type text not null check(type in ('follow', 'reaction')),
197198 created_at text not null default (strftime('%Y-%m-%dT%H:%M:%SZ', 'now')),
199
···193 subject_uri text not null,
194195 state text not null default 'unread' check(state in ('unread', 'read')),
196+ type text not null check(type in ('follow', 'reaction', 'comment')),
197198 created_at text not null default (strftime('%Y-%m-%dT%H:%M:%SZ', 'now')),
199