feat: backend service

This commit is contained in:
Ilia Denisov
2026-05-06 10:14:55 +03:00
committed by GitHub
parent 3e2622757e
commit f446c6a2ac
1486 changed files with 49720 additions and 266401 deletions
+35
View File
@@ -0,0 +1,35 @@
package notification
import (
"context"
"github.com/google/uuid"
"go.uber.org/zap"
)
// OnUserDeleted is the user-side soft-delete cascade hook. It marks
// every pending or retrying route owned by userID as `skipped` so the
// worker stops trying to deliver to a vanished account; published
// rows stay intact as audit trail.
//
// The catalog (`backend/README.md` §10) does not include a
// `user.*` kind, so this is the only place where the notification
// module reacts to user lifecycle events directly. The cascade is
// idempotent — repeated invocations on the same user simply find no
// pending rows.
func (s *Service) OnUserDeleted(ctx context.Context, userID uuid.UUID) error {
if userID == uuid.Nil {
return nil
}
skipped, err := s.deps.Store.SkipPendingRoutesForUser(ctx, userID, s.nowUTC())
if err != nil {
return err
}
if skipped > 0 {
s.deps.Logger.Info("notification routes skipped on user delete",
zap.String("user_id", userID.String()),
zap.Int64("count", skipped),
)
}
return nil
}