Skip to content

Notification Model

Source: pharmanet/lib/core/models/notification_model.dart

AppNotification — @freezed

Field Type Description
id int Auto-increment ID
userId String FK to profiles
type String order_created, order_status, promotion_activated, system, etc.
title String? Notification title
message String? Notification body
relatedId String? FK to related entity
relatedType String? order, product, promotion
isRead bool Read status
readAt DateTime? When it was read
data Map<String, dynamic>? Arbitrary JSON payload
createdAt DateTime? Creation timestamp

Legacy Model (CMS)

There is also a simpler notification model in cms_model.dart without the data JSONB field:

Field Type Description
id String UUID
userId String FK to profiles
type String Notification type
title String Title
message String Body
relatedId String? Related entity ID
relatedType String? Entity type
isRead bool Read status
readAt DateTime? Read timestamp
createdAt DateTime? Creation timestamp