From c94890b9f061383d40253864c3282771a019efb5 Mon Sep 17 00:00:00 2001 From: Joe Ardent Date: Sat, 10 Jun 2023 11:32:40 -0700 Subject: [PATCH] checkpoint --- src/lib.rs | 6 +++--- src/watches/handlers.rs | 13 +++++++++++-- src/watches/templates.rs | 4 ++++ templates/get_watches.html | 2 +- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 482ba6a..28f9dc9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -26,10 +26,10 @@ type AuthContext = axum_login::extractors::AuthContext>; /// Returns the router to be used as a service or test object, you do you. -pub async fn app(db_pool: sqlx::SqlitePool, secret: &[u8]) -> axum::Router { +pub async fn app(db_pool: sqlx::SqlitePool, session_secret: &[u8]) -> axum::Router { use axum::{middleware, routing::get}; - let session_layer = db::session_layer(db_pool.clone(), secret).await; - let auth_layer = db::auth_layer(db_pool.clone(), secret).await; + let session_layer = db::session_layer(db_pool.clone(), session_secret).await; + let auth_layer = db::auth_layer(db_pool.clone(), session_secret).await; // don't bother bringing handlers into the whole crate namespace use generic_handlers::{handle_slash, handle_slash_redir}; diff --git a/src/watches/handlers.rs b/src/watches/handlers.rs index bc103ad..761b9e8 100644 --- a/src/watches/handlers.rs +++ b/src/watches/handlers.rs @@ -1,5 +1,7 @@ +use std::path::Path; + use axum::{ - extract::{Form, Path, State}, + extract::{Form, Query, State}, http::StatusCode, response::{IntoResponse, Response}, }; @@ -38,9 +40,16 @@ impl IntoResponse for WatchAddError { } } -/// Add a Watch to the whole system +//-************************************************************************ +// handlers +//-************************************************************************ + +/// Add a new Watch to the whole system (also adds to your watchlist) pub async fn put_add_watch() {} +/// Add a Watch to your watchlist +pub async fn post_add_watch() {} + /// A single Watch pub async fn get_watch() {} diff --git a/src/watches/templates.rs b/src/watches/templates.rs index 1ab4075..5aa9629 100644 --- a/src/watches/templates.rs +++ b/src/watches/templates.rs @@ -9,3 +9,7 @@ pub struct GetWatches { pub watches: Vec, pub user: Option, } + +#[derive(Debug, Default, Template, Deserialize, Serialize, PartialEq, Eq)] +#[template(path = "get_search_watches.html")] +pub struct GetSearchWatches {} diff --git a/templates/get_watches.html b/templates/get_watches.html index 408382c..4222a7b 100644 --- a/templates/get_watches.html +++ b/templates/get_watches.html @@ -22,7 +22,7 @@ Hello, {{ usr.username }}! It's nice to see you.

-

+