Add demo of query params for searching watches.

This commit is contained in:
Joe Ardent 2023-06-10 15:32:50 -07:00
parent 8b1eef17f7
commit 9ac4810d80

View file

@ -5,6 +5,7 @@ use axum::{
http::StatusCode,
response::{IntoResponse, Response},
};
use serde::Deserialize;
use sqlx::{query_as, SqlitePool};
use uuid::Uuid;
@ -40,6 +41,11 @@ impl IntoResponse for WatchAddError {
}
}
#[derive(Debug, Default, Clone, Deserialize)]
pub struct SimpleSearchQuery {
search: String,
}
//-************************************************************************
// handlers
//-************************************************************************
@ -72,6 +78,16 @@ pub async fn get_watches(auth: AuthContext, State(pool): State<SqlitePool>) -> i
}
}
pub async fn get_search_watch() {}
pub async fn get_search_watch(
_auth: AuthContext,
State(pool): State<SqlitePool>,
search: Option<Query<SimpleSearchQuery>>,
) {
let search = match search {
Some(Query(SimpleSearchQuery { search })) => search,
None => "".to_owned(),
};
let search = search.trim();
}
pub async fn post_search_watch() {}