1
0
forked from wrenn/wrenn

feat: send email notification on account hard-delete

Notify users via email when their account is permanently deleted after
the 15-day soft-delete grace period. Query now returns email alongside
user ID so the notification can be sent after deletion.

Email failure is logged as a warning but does not block cleanup.
This commit is contained in:
2026-04-21 16:01:56 +06:00
parent bb2146d838
commit 11928a172a
3 changed files with 24 additions and 10 deletions

View File

@ -92,7 +92,7 @@ WHERE ut.user_id = $1
);
-- name: ListExpiredSoftDeletedUsers :many
SELECT id FROM users WHERE deleted_at IS NOT NULL AND deleted_at < NOW() - INTERVAL '15 days';
SELECT id, email FROM users WHERE deleted_at IS NOT NULL AND deleted_at < NOW() - INTERVAL '15 days';
-- name: HardDeleteUser :exec
DELETE FROM users WHERE id = $1;