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

Function insert_test_user

crates/server/src/task/session_cleaner.rs:78–94  ·  view source on GitHub ↗

Seed a parent user row so sessions satisfy the `user_id` foreign key.

(db: &DatabaseConnection, id: &str)

Source from the content-addressed store, hash-verified

76
77 /// Seed a parent user row so sessions satisfy the `user_id` foreign key.
78 async fn insert_test_user(db: &DatabaseConnection, id: &str) {
79 let now = Utc.with_ymd_and_hms(2026, 1, 1, 0, 0, 0).unwrap();
80 user::ActiveModel {
81 id: Set(id.to_string()),
82 username: Set(format!("user-{id}")),
83 password_hash: Set("hash".to_string()),
84 role: Set("admin".to_string()),
85 totp_secret: Set(None),
86 must_change_password: Set(false),
87 password_changed_at: Set(None),
88 created_at: Set(now),
89 updated_at: Set(now),
90 }
91 .insert(db)
92 .await
93 .expect("insert test user should succeed");
94 }
95
96 async fn insert_test_session(
97 db: &DatabaseConnection,

Calls

no outgoing calls

Tested by

no test coverage detected