MCPcopy Create free account
hub / github.com/ZingerLittleBee/ServerBee / insert_webhook_group

Function insert_webhook_group

crates/server/src/service/security.rs:525–550  ·  view source on GitHub ↗
(db: &DatabaseConnection, port: u16)

Source from the content-addressed store, hash-verified

523 }
524
525 async fn insert_webhook_group(db: &DatabaseConnection, port: u16) -> String {
526 let now = Utc::now();
527 notification::ActiveModel {
528 id: Set("notif-sec".to_string()),
529 name: Set("Hook".to_string()),
530 notify_type: Set("webhook".to_string()),
531 config_json: Set(format!(
532 r#"{{"url":"http://127.0.0.1:{port}/","method":"POST"}}"#
533 )),
534 enabled: Set(true),
535 created_at: Set(now),
536 }
537 .insert(db)
538 .await
539 .unwrap();
540 notification_group::ActiveModel {
541 id: Set("grp-sec".to_string()),
542 name: Set("Group".to_string()),
543 notification_ids_json: Set(r#"["notif-sec"]"#.to_string()),
544 created_at: Set(now),
545 }
546 .insert(db)
547 .await
548 .unwrap();
549 "grp-sec".to_string()
550 }
551
552 #[tokio::test]
553 async fn record_event_persists_and_broadcasts() {

Calls

no outgoing calls

Tested by

no test coverage detected