Notification Domain
Manages in-app notifications for admin and staff users. Notifications are created internally by other domain services (identity, commerce, analytics) when significant events occur — customer registration, password reset, order placement, report generation. Admin staff can list and mark them as read.
Handles:
- Notification listing — all notifications for the current authority level
- Mark as read — update notification read/deleted state
- Push notifications to mobile (planned)
- Notification preferences per user (planned)
Architecture
graph LR
IdentityDomain["Identity Domain"]
CommerceDomain["Commerce Domain"]
AnalyticsDomain["Analytics Domain"]
NotifService["NotificationService"]
DB["Ticketing DB\n(notification)"]
AdminFrontend["Admin Frontend"]
IdentityDomain -->|CreateNotification| NotifService
CommerceDomain -->|CreateNotification| NotifService
AnalyticsDomain -->|CreateNotification| NotifService
NotifService --> DB
AdminFrontend -->|GET /api/notifications| DB
AdminFrontend -->|PUT /api/notification| DB
Notifications are written by domain services via the INotificationService interface. They are never created directly by the API client.
Data Model
erDiagram
Notification {
uint notificationId
string performedBy
string authorityLevel
string type
string title
string message
string date
bool isRead
bool isDeleted
}
Notification Types
type |
Trigger |
|---|---|
Customer |
Customer created an account or updated profile |
Password reset |
Password reset email was sent |
Admin Account Profile |
Admin changed their profile or password |
Admin Management |
SYSADMIN created/updated/deleted an admin |
authorityLevel mirrors the user's role: ADMIN, SYSADMIN, MEMBER, CUSTOMER, or system.
Endpoints
All endpoints require Authorization: Bearer <token> with role ADMIN, SYSADMIN, or MEMBER.
GET /api/notifications
List all non-deleted notifications. Returns newest first.
Response 200
{
"success": true,
"data": [
{
"notificationId": 42,
"performedBy": "Ahmad Bin Ali",
"authorityLevel": "CUSTOMER",
"type": "Customer",
"title": "New customer created",
"message": "ahmad@example.com (Ahmad Bin Ali) has created an account",
"date": "23-06-2026 10:00:00",
"isRead": false,
"isDeleted": false,
"createdAt": "2026-06-23T10:00:00Z",
"updatedAt": "2026-06-23T10:00:00Z"
}
]
}
PUT /api/notification
Update a notification — mark as read, or soft-delete. Pass the notification ID in the body along with the fields to update.
Request
{
"notificationId": 42,
"isRead": true
}
Or to delete:
{
"notificationId": 42,
"isDeleted": true
}
Response 200
{ "success": true, "data": { "success": true } }
Internal API
The NotificationService.CreateNotification method is called by other domains:
CreateNotification(performedBy, authorityLevel, notificationType, title, message, date string) error
This is not an HTTP endpoint — it is an internal Go service call.