This commit is contained in:
2025-04-05 10:17:23 +02:00
parent c7a7201cfd
commit 8e91ad93ee
13 changed files with 384 additions and 741 deletions

View File

@@ -45,7 +45,11 @@ pub fn run_db_examples() -> Result<(), Box<dyn std::error::Error>> {
"123-456-7890".to_string(),
"www.example.com".to_string(),
"123 Example St, Example City".to_string(),
BusinessType::Global,
BusinessType::new(BusinessType::GLOBAL.to_string())
.unwrap_or_else(|e| {
eprintln!("Warning: {}", e);
BusinessType::new_unchecked(BusinessType::GLOBAL.to_string())
}),
"Technology".to_string(),
"An example company".to_string(),
CompanyStatus::Active,

View File

@@ -47,7 +47,11 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
"+1-555-123-4567".to_string(),
"https://acmecorp.com".to_string(),
"123 Main St, Anytown, USA".to_string(),
BusinessType::Coop,
BusinessType::new(BusinessType::COOP.to_string())
.unwrap_or_else(|e| {
eprintln!("Warning: {}", e);
BusinessType::new_unchecked(BusinessType::COOP.to_string())
}),
"Technology".to_string(),
"A leading technology company".to_string(),
CompanyStatus::Active,
@@ -56,7 +60,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
// Insert the company
db.insert(&company)?;
println!("Company created: {} (ID: {})", company.name, company.id);
println!("Status: {:?}, Business Type: {:?}", company.status, company.business_type);
println!("Status: {:?}, Business Type: {}", company.status, company.business_type.as_str());
println!("\n2. Creating Users");
println!("---------------");