fts wip: trigger, Quote::get_by_search_query, expose to API
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user