feat(platform): add the notification inbox and deterministic match search

This commit is contained in:
shira committed 2026-10-09 13:14:46 +03:00
1 parent 5edff21d2d
commit 0b11021b16
169 files changed
+17083 -443

No files matched your search

@@ -17,6 +17,17 @@ var (
// ErrNotificationInboxEventConflict reports an event ID reused with
// different immutable recipient or source metadata.
ErrNotificationInboxEventConflict = errors.New("notification inbox event metadata conflicts")
// ErrNotificationInboxReferenceMissing reports an event that names an
// organization that does not exist. A retry cannot fix it.
ErrNotificationInboxReferenceMissing = errors.New("notification inbox event references a missing record")
// ErrNotificationInboxRecipientMissing reports a recipient account that
// does not exist now. The recipient may have been deleted a moment ago,
// so a handler retries and then skips instead of rejecting the event.
ErrNotificationInboxRecipientMissing = errors.New("notification inbox recipient does not exist")
// ErrNotificationInboxSourceNotVisible reports a source that does not
// exist or is not visible to the recipient now. The two cases are one on
// purpose.
ErrNotificationInboxSourceNotVisible = errors.New("notification source is not visible to the recipient")
)
const MaxNotificationInboxPageSize = 100
@@ -33,15 +44,25 @@ type NotificationInboxRepository interface {
// OrganizationID means all organization contexts of that recipient.
List(ctx context.Context, query NotificationInboxListQuery) (NotificationInboxPage, error)
// MarkRead records the first read time in exact recipient and organization
// context. Missing and unauthorized identities share one not-found result.
// MarkRead records the first read time for the recipient. A non-nil
// organizationID narrows the match to that organization context; nil
// matches any context of the recipient, which is the candidate cabinet.
// Missing and unauthorized identities share one not-found result.
MarkRead(
ctx context.Context,
recipientUserID uuid.UUID,
organizationID uuid.UUID,
organizationID *uuid.UUID,
eventID uuid.UUID,
at time.Time,
) (domain.NotificationInboxEntry, error)
// OrganizationNameForRecipient returns the current name of an
// organization under the recipient's current standing: a candidate who has
// not hidden it, or an employer with an active membership in it. It
// returns ErrNotificationInboxSourceNotVisible otherwise. Content that
// names an organization is resolved through it at read time, so a hiding
// or a revoked membership removes the name from every later read.
OrganizationNameForRecipient(ctx context.Context, recipientUserID, organizationID uuid.UUID) (string, error)
}
// NotificationInboxListQuery selects a bounded recipient-owned page.