Add trait for db_model to model conversion
This commit is contained in:
		
							parent
							
								
									8dab4b9a50
								
							
						
					
					
						commit
						cb47dcda5c
					
				
					 5 changed files with 92 additions and 59 deletions
				
			
		| 
						 | 
				
			
			@ -3,6 +3,7 @@ use std::str;
 | 
			
		|||
use crate::relay_loop::run_relay_loop;
 | 
			
		||||
use crate::settings::Settings;
 | 
			
		||||
use emgauwa_lib::db::{DbController, DbRelay};
 | 
			
		||||
use emgauwa_lib::models::convert_db_list;
 | 
			
		||||
use emgauwa_lib::types::ControllerUid;
 | 
			
		||||
use emgauwa_lib::{db, models};
 | 
			
		||||
use futures::channel::mpsc;
 | 
			
		||||
| 
						 | 
				
			
			@ -88,10 +89,7 @@ async fn main() {
 | 
			
		|||
		.await
 | 
			
		||||
		.unwrap();
 | 
			
		||||
 | 
			
		||||
	let relays = db_relays
 | 
			
		||||
		.into_iter()
 | 
			
		||||
		.map(|relay| models::Relay::from_db_relay(relay, &mut conn))
 | 
			
		||||
		.collect();
 | 
			
		||||
	let relays = convert_db_list(&mut conn, db_relays).expect("Failed to convert relays");
 | 
			
		||||
 | 
			
		||||
	let this = models::Controller {
 | 
			
		||||
		controller: db_controller,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue