Replace inbox_listeners.go with a subscriber-driven notification system: - Add issue_subscriber table with auto-subscribe on create/assign/comment - New subscriber_listeners.go: maintains subscriber data on domain events - New notification_listeners.go: notifySubscribers (fanout to all subscribers minus actor) and notifyDirect (targeted, punches through unsubscribe) - Subscriber API: list/subscribe/unsubscribe endpoints - Frontend: subscribers section in issue detail sidebar with real-time sync - Frontend: inbox notification grouping by (issue_id, type, actor_id) - Remove createInboxForIssueCreator from task.go (unified through event bus) - 21 new Go tests, all passing Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
19 lines
574 B
SQL
19 lines
574 B
SQL
-- name: AddIssueSubscriber :exec
|
|
INSERT INTO issue_subscriber (issue_id, user_type, user_id, reason)
|
|
VALUES ($1, $2, $3, $4)
|
|
ON CONFLICT (issue_id, user_type, user_id) DO NOTHING;
|
|
|
|
-- name: RemoveIssueSubscriber :exec
|
|
DELETE FROM issue_subscriber
|
|
WHERE issue_id = $1 AND user_type = $2 AND user_id = $3;
|
|
|
|
-- name: ListIssueSubscribers :many
|
|
SELECT * FROM issue_subscriber
|
|
WHERE issue_id = $1
|
|
ORDER BY created_at;
|
|
|
|
-- name: IsIssueSubscriber :one
|
|
SELECT EXISTS(
|
|
SELECT 1 FROM issue_subscriber
|
|
WHERE issue_id = $1 AND user_type = $2 AND user_id = $3
|
|
) AS subscribed;
|