Notification API Overview
Complete guide to NYYU notification system types, structures, and settings
Notification API
Manage user notifications, notification types, and settings with a powerful binary configuration system
Overview
The Notification API provides a comprehensive system for managing user notifications in the NYYU platform. It includes notification types, individual notifications, and an efficient binary-based settings storage system.
Core Types
NotificationType
type NotificationType {
type: String
index: Int
}
The name of the notification type (e.g., "NEW ROUND STARTED", "BID RANKING UPDATED")
The unique numeric identifier for this notification type
Notification
type Notification {
id: Int
userId: Int
timeStamp: Float
nType: Int
read: Boolean
title: String
msg: String
}
id
- Unique notification identifieruserId
- Recipient user IDnType
- Notification type indexread
- Read status flagtimeStamp
- Unix timestamp when senttitle
- Notification titlemsg
- Notification message bodyNotification Settings System
To optimize notification delivery, user notification settings are stored as a single integer value. Each notification type corresponds to a specific bit position in the binary representation.
Each bit in the settings integer represents whether a specific notification type is enabled (1) or disabled (0)
Notification Type Values
Type Value | Binary Position | Notification Type Name | Binary Representation |
---|---|---|---|
0 | Bit 0 | NEW ROUND STARTED | 0000,0000,0000,0001b |
1 | Bit 1 | BID RANKING UPDATED | 0000,0000,0000,0010b |
2 | Bit 2 | ROUND FINISHED | 0000,0000,0000,0100b |
3 | Bit 3 | PAYMENT RESULT | 0000,0000,0000,1000b |
4 | Bit 4 | VERIFICATION RESULT | 0000,0000,0001,0000b |
... | ... | Additional types... | ... |
Settings Calculation Examples
User has enabled: BID RANKING UPDATED (1), PAYMENT RESULT (3), and VERIFICATION RESULT (4)
The user profile stores the integer value 26
to represent these three enabled notification types
User has enabled all five notification types
User only wants NEW ROUND STARTED (0) notifications
Checking Notification Settings
To check if a specific notification type is enabled for a user, use bitwise AND operation:
Use Cases
Quickly determine which users should receive specific notifications using bitwise operations
Store unlimited notification preferences in a single integer field
Allow users to customize which notifications they want to receive
Track read/unread status and manage notification history