fts wip: trigger, Quote::get_by_search_query, expose to API

This commit is contained in:
2026-04-25 01:00:18 +02:00
parent 983e1ae88f
commit 84e2ad3918
4 changed files with 65 additions and 0 deletions

View File

@@ -30,6 +30,16 @@ pub async fn get_by_id(
Ok(Json(Quote::get_by_id(&mut conn, id).await?).into_response())
}
pub async fn get_by_query(
State(state): State<MnemoState>,
headers: HeaderMap,
Json(q): Json<String>,
) -> Result<Response, CompositeError> {
let mut conn = state.pool.acquire().await?;
User::authenticate(&mut conn, &headers).await?.required()?;
Ok(Json(Quote::get_by_search_query(&mut conn, &q).await?).into_response())
}
#[derive(Deserialize)]
pub struct QuoteLineForm {
pub content: String,