pub async fn create_role_notification(
pool: &Pool<MySql>,
role_id: i64,
message: &str,
notification_type: &str,
org_id: Option<i64>,
app_id: Option<i64>,
importance: Option<&str>,
action_url: Option<&str>,
action_label: Option<&str>,
expires_at: Option<DateTime<Utc>>,
) -> Result<RoleNotification>
Expand description
Creates a new notification for a role.
This function inserts a new role notification record that will be visible to all users with the specified role.
§Arguments
pool
- Database connection pool for executing the queryrole_id
- ID of the role to notifymessage
- The notification message textnotification_type
- Type of notification (info, warning, error, success)org_id
- Optional organization ID related to the notificationapp_id
- Optional application ID related to the notificationimportance
- Optional importance level (default is “normal”)action_url
- Optional URL for a related actionaction_label
- Optional label for the action buttonexpires_at
- Optional expiration date for the notification
§Returns
Ok(RoleNotification)
- Successfully created notificationErr(anyhow::Error)
- Failed to create notification