feat(platform): add the notification inbox and deterministic match search
This commit is contained in:
1 parent
5edff21d2d
commit
0b11021b16
169 files changed
+17083
-443
No files matched your search
@@ -57,6 +57,7 @@ func TestRestoreNotificationInboxEntryRejectsInvalidMetadata(t *testing.T) {
|
||||
{name: "unknown event type", mutate: func(input *NotificationInboxEntryInput) { input.EventType = "notification.mail_requested" }},
|
||||
{name: "unsupported schema version", mutate: func(input *NotificationInboxEntryInput) { input.SchemaVersion = 2 }},
|
||||
{name: "unknown source type", mutate: func(input *NotificationInboxEntryInput) { input.SourceType = "mail_request" }},
|
||||
{name: "source type of another event type", mutate: func(input *NotificationInboxEntryInput) { input.SourceType = NotificationInboxSourceOrganization }},
|
||||
{name: "missing occurrence time", mutate: func(input *NotificationInboxEntryInput) { input.OccurredAt = time.Time{} }},
|
||||
{name: "zero read time", mutate: func(input *NotificationInboxEntryInput) { input.ReadAt = &zeroTime }},
|
||||
}
|
||||
@@ -118,3 +119,21 @@ func TestNotificationInboxEntryMarkReadPreservesFirstTimestamp(t *testing.T) {
|
||||
t.Fatal("MarkRead changed immutable source identity")
|
||||
}
|
||||
}
|
||||
|
||||
func TestNotificationInboxEntryAcceptsTheSyntheticEventOnlyWithItsSource(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
input := NotificationInboxEntryInput{
|
||||
EventID: uuid.New(), RecipientUserID: uuid.New(), OrganizationID: uuid.New(),
|
||||
EventType: NotificationInboxSyntheticDelivered, SchemaVersion: 1,
|
||||
SourceType: NotificationInboxSourceOrganization, SourceID: uuid.New(),
|
||||
OccurredAt: time.Date(2026, time.October, 8, 12, 30, 0, 0, time.UTC),
|
||||
}
|
||||
if _, err := NewNotificationInboxEntry(input); err != nil {
|
||||
t.Fatalf("NewNotificationInboxEntry(synthetic) error = %v", err)
|
||||
}
|
||||
input.SourceType = NotificationInboxSourceInvitation
|
||||
if _, err := NewNotificationInboxEntry(input); !errors.Is(err, ErrInvalidNotificationInboxEntry) {
|
||||
t.Fatalf("NewNotificationInboxEntry(synthetic with invitation source) error = %v, want ErrInvalidNotificationInboxEntry", err)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user