NotificationLogEntry
final class NotificationLogEntry : Model, @unchecked Sendable
A single notification event that was pushed to one or more users’ notification websockets.
Named NotificationLogEntry rather than Notification to avoid colliding with Foundation.Notification
(NotificationCenter’s type)–that name is ambiguous outside this module (e.g. in AppTests), where it
silently resolves to the wrong type instead of raising a redeclaration error.
One row is written per fan-out event, not per recipient–who received it is recorded separately in
NotificationRecipient, so a broadcast notification (e.g. an .announcement) sent to every user only
stores its content once. The row’s id doubles as the notificationID included in the live
SocketNotificationData push, letting clients de-dupe a live push against a later fetch of
GET /api/v3/notification/log.
-
Declaration
Swift
static let schema: String
-
The entry’s ID. Also sent to socket clients as
SocketNotificationData.notificationID.Declaration
Swift
@NotificationLogEntry .ID var id: UUID? { get set } -
The type of event that happened, stored as
SocketNotificationData.NotificationTypeData.databaseKey. SeeNotificationLogData.init(_:)for how this is decoded back into aNotificationTypeData.Declaration
Swift
@NotificationLogEntry .Field var typeKey: String { get set } -
A string describing what happened, suitable for adding to a notification alert.
Declaration
Swift
@NotificationLogEntry .Field var info: String { get set } -
An ID of an Announcement, Fez, Twarrt, ForumPost, or Event.
Declaration
Swift
@NotificationLogEntry .Field var contentID: String { get set } -
An ID of a related parent object, when one exists. See
SocketNotificationData.secondaryContentID.Declaration
Swift
@NotificationLogEntry .OptionalField var secondaryContentID: String? { get set } -
Timestamp of the model’s creation, set automatically.
Declaration
Swift
@NotificationLogEntry .Timestamp var createdAt: Date? { get set }
-
Declaration
Swift
init() -
Initializes a new NotificationLogEntry.
Declaration
Swift
init(type: SocketNotificationData.NotificationTypeData, info: String, contentID: String, secondaryContentID: String? = nil)
View on GitHub