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

Function insert_server

crates/server/src/router/api/server.rs:1540–1583  ·  view source on GitHub ↗
(db: &sea_orm::DatabaseConnection, id: &str, name: &str)

Source from the content-addressed store, hash-verified

1538 server::Model {
1539 id: id.to_string(),
1540 token_hash: Some("hash".to_string()),
1541 token_prefix: Some("prefix".to_string()),
1542 name: name.to_string(),
1543 cpu_name: None,
1544 cpu_cores: None,
1545 cpu_arch: None,
1546 os: os.map(str::to_string),
1547 kernel_version: None,
1548 mem_total: None,
1549 swap_total: None,
1550 disk_total: None,
1551 ipv4: None,
1552 ipv6: None,
1553 region: None,
1554 country_code: None,
1555 geo_manual: false,
1556 virtualization: None,
1557 agent_version: None,
1558 group_id: None,
1559 weight: 0,
1560 hidden: false,
1561 remark: None,
1562 public_remark: None,
1563 price: None,
1564 billing_cycle: None,
1565 currency: None,
1566 expired_at: None,
1567 traffic_limit: None,
1568 traffic_limit_type: None,
1569 billing_start_day: None,
1570 capabilities: CAP_DEFAULT as i32,
1571 protocol_version: 1,
1572 features: "[]".to_string(),
1573 last_remote_addr: None,
1574 created_at: now,
1575 updated_at: now,
1576 }
1577 }
1578
1579 #[test]
1580 fn test_no_match_returns_none() {
1581 assert_eq!(remove_ids_from_json(r#"["a","b"]"#, &["c".into()]), None);
1582 }
1583
1584 #[test]
1585 fn test_partial_removal() {
1586 let result = remove_ids_from_json(r#"["a","b","c"]"#, &["b".into()]);

Callers 2

Calls

no outgoing calls

Tested by

no test coverage detected