Mail sending optimization - implemented mail queue. Some minor optimizations.

This commit is contained in:
2024-04-23 20:43:43 +02:00
parent 0a87a6d7cb
commit 7ca3e0a258
8 changed files with 106 additions and 34 deletions
+2 -2
View File
@@ -7,7 +7,7 @@ use crate::components::data_form::ForValidation;
cfg_if! { if #[cfg(feature = "ssr")] {
use crate::backend::get_pool;
pub async fn get_props(filter: Option<String>) -> Result<Vec<ResProperty>, ServerFnError> {
pub async fn get_props(filter: Option<&'static str>) -> Result<Vec<ResProperty>, ServerFnError> {
let pool = get_pool().await?;
let props = if let Some(f) = filter {
sqlx::query_as::<_, ResProperty>(&format!("SELECT * FROM property WHERE {} ORDER BY id", f)).fetch_all(&pool).await?
@@ -38,7 +38,7 @@ pub async fn get_properties() -> Result<ApiResponse<Vec<ResProperty>>, ServerFnE
#[server]
pub async fn get_active_properties() -> Result<ApiResponse<Vec<ResProperty>>, ServerFnError> {
let props = get_props(Some("active = true".to_string())).await?;
let props = get_props(Some("active = true")).await?;
Ok(ApiResponse::Data(props))
}