Add notification to controllers on schedule change
This commit is contained in:
		
							parent
							
								
									3b00001859
								
							
						
					
					
						commit
						dd850766fd
					
				
					 4 changed files with 59 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -45,6 +45,23 @@ impl DbJunctionRelaySchedule {
 | 
			
		|||
		.map_err(DatabaseError::from)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	pub async fn get_relays(
 | 
			
		||||
		conn: &mut PoolConnection<Sqlite>,
 | 
			
		||||
		schedule: &DbSchedule,
 | 
			
		||||
	) -> Result<Vec<DbRelay>, DatabaseError> {
 | 
			
		||||
		sqlx::query_as!(
 | 
			
		||||
			DbRelay,
 | 
			
		||||
			r#"SELECT relays.* FROM relays INNER JOIN junction_relay_schedule
 | 
			
		||||
			ON junction_relay_schedule.relay_id = relays.id
 | 
			
		||||
			WHERE junction_relay_schedule.schedule_id = ?
 | 
			
		||||
			ORDER BY junction_relay_schedule.weekday"#,
 | 
			
		||||
			schedule.id
 | 
			
		||||
		)
 | 
			
		||||
		.fetch_all(conn.deref_mut())
 | 
			
		||||
		.await
 | 
			
		||||
		.map_err(DatabaseError::from)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	pub async fn get_schedule(
 | 
			
		||||
		conn: &mut PoolConnection<Sqlite>,
 | 
			
		||||
		relay: &DbRelay,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue