schemas_v1_models_notification - OmniCloudOrg/OmniOrchestrator GitHub Wiki
Path: src/schemas/v1/models/notification.rs
- struct UserNotification
- struct RoleNotification
- struct NotificationAcknowledgment
- struct NotificationWithCount
- struct UserNotificationWithRoleNotifications
- struct Notification
pub struct UserNotification {
pub id: i64,
pub user_id: i64,
pub org_id: Option<i64>,
pub app_id: Option<i64>,
pub notification_type: String,
pub message: String,
pub read_status: bool,
pub importance: String,
pub action_url: Option<String>,
pub action_label: Option<String>,
pub created_at: DateTime<Utc>,
pub expires_at: Option<DateTime<Utc>>,
}
pub struct RoleNotification {
pub id: i64,
pub role_id: i64,
pub org_id: Option<i64>,
pub app_id: Option<i64>,
pub notification_type: String,
pub message: String,
pub importance: String,
pub action_url: Option<String>,
pub action_label: Option<String>,
pub created_at: DateTime<Utc>,
pub expires_at: Option<DateTime<Utc>>,
}
pub struct NotificationAcknowledgment {
pub id: i64,
pub user_id: i64,
pub notification_id: Option<i64>,
pub role_notification_id: Option<i64>,
pub acknowledged_at: DateTime<Utc>
}
pub struct NotificationWithCount {
/// Direct notifications for the user
pub user_notifications: Vec<UserNotification>,
/// Role-based notifications applicable to the user
pub role_notifications: Vec<RoleNotification>,
/// User's acknowledgments of role notifications
pub acknowledgments: Vec<NotificationAcknowledgment>,
/// Count of unread direct user notifications
pub unread_user_count: i64,
/// Count of unacknowledged role notifications
pub unacknowledged_role_count: i64,
/// Total count of unread notifications (user + role)
pub total_unread_count: i64
}
Represents a comprehensive view of a user's notifications with unread counts. This is useful for providing notification center overviews.
pub struct UserNotificationWithRoleNotifications {
/// Direct notifications for the user
pub user_notifications: Vec<UserNotification>,
/// Role-based notifications applicable to the user
pub role_notifications: Vec<RoleNotification>,
/// User's acknowledgments of role notifications
pub acknowledgments: Vec<NotificationAcknowledgment>
}
Represents a user's notifications including those from their roles. This combines personal notifications with role-based ones.
pub struct Notification {
pub id: i64,
pub user_id: Option<i64>,
pub org_id: Option<i64>,
pub app_id: Option<i64>,
pub notification_type: String, // enum: 'info', 'warning', 'error', 'success'
pub message: String,
pub read_status: bool,
pub created_at: DateTime<Utc>,