remove useless route

This commit is contained in:
Joe Ardent 2023-06-15 17:00:45 -07:00
parent 7c42b6316a
commit 0fbcfb9c8c
4 changed files with 20 additions and 22 deletions

View File

@ -18,7 +18,7 @@ create table if not exists witches (
-- table of things to watch -- table of things to watch
create table if not exists watches ( create table if not exists watches (
id blob not null primary key, id blob not null primary key,
typ int not null, -- enum for movie or tv show or whatev kind int not null, -- enum for movie or tv show or whatev
title text not null, title text not null,
metadata_url text, -- possible url for imdb or other metadata-esque site to show the user metadata_url text, -- possible url for imdb or other metadata-esque site to show the user
length int, length int,

View File

@ -38,9 +38,7 @@ pub async fn app(db_pool: sqlx::SqlitePool, session_secret: &[u8]) -> axum::Rout
use generic_handlers::{handle_slash, handle_slash_redir}; use generic_handlers::{handle_slash, handle_slash_redir};
use login::{get_login, get_logout, post_login, post_logout}; use login::{get_login, get_logout, post_login, post_logout};
use signup::{get_create_user, handle_signup_success, post_create_user}; use signup::{get_create_user, handle_signup_success, post_create_user};
use watches::handlers::{ use watches::handlers::{get_search_watch, get_watches, post_add_watch};
get_search_watch, get_watches, post_add_watch, post_search_watch, put_add_watch,
};
axum::Router::new() axum::Router::new()
.route("/", get(handle_slash).post(handle_slash)) .route("/", get(handle_slash).post(handle_slash))
@ -51,13 +49,8 @@ pub async fn app(db_pool: sqlx::SqlitePool, session_secret: &[u8]) -> axum::Rout
.route("/watches", get(get_watches)) .route("/watches", get(get_watches))
.route("/watch", get(get_watch)) .route("/watch", get(get_watch))
.route("/watch/:id", get(get_watch)) .route("/watch/:id", get(get_watch))
.route("/search", get(get_search_watch).post(post_search_watch)) .route("/search", get(get_search_watch))
.route( .route("/add", get(get_search_watch).post(post_add_watch))
"/add",
get(get_search_watch)
.put(put_add_watch)
.post(post_add_watch),
)
.fallback(handle_slash_redir) .fallback(handle_slash_redir)
.layer(middleware::from_fn_with_state( .layer(middleware::from_fn_with_state(
db_pool.clone(), db_pool.clone(),

View File

@ -74,11 +74,8 @@ impl Default for SearchQuery {
// handlers // handlers
//-************************************************************************ //-************************************************************************
/// Add a new Watch to the whole system (also adds to your watchlist) /// Add a Watch to your watchlist (side effects system-add if missing)
pub async fn put_add_watch() {} pub async fn post_add_watch() -> impl IntoResponse {}
/// Add a Watch to your watchlist
pub async fn post_add_watch() {}
/// A single Watch /// A single Watch
pub async fn get_watch( pub async fn get_watch(
@ -146,4 +143,5 @@ pub async fn get_search_watch(
} }
} }
pub async fn post_search_watch() {}
}

View File

@ -7,7 +7,7 @@ pub mod templates;
#[derive( #[derive(
Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize, sqlx::Type, Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize, sqlx::Type,
)] )]
#[repr(i32)] #[repr(i64)]
pub enum ShowKind { pub enum ShowKind {
Movie = 0, Movie = 0,
Series = 1, Series = 1,
@ -18,7 +18,14 @@ pub enum ShowKind {
impl std::fmt::Display for ShowKind { impl std::fmt::Display for ShowKind {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
todo!() let repr = match self {
Self::Movie => "movie",
Self::Series => "series",
Self::LimitedSeries => "limited series",
Self::Short => "short form",
Self::Unknown => "unknown",
};
write!(f, "{repr}")
} }
} }
@ -28,8 +35,8 @@ impl Default for ShowKind {
} }
} }
impl From<i32> for ShowKind { impl From<i64> for ShowKind {
fn from(value: i32) -> Self { fn from(value: i64) -> Self {
match value { match value {
0 => Self::Movie, 0 => Self::Movie,
1 => Self::Series, 1 => Self::Series,
@ -59,7 +66,7 @@ pub struct Watch {
pub kind: ShowKind, pub kind: ShowKind,
pub title: String, pub title: String,
pub metadata_url: Option<String>, pub metadata_url: Option<String>,
pub length: Option<i32>, pub length: Option<i64>,
pub release_date: Option<i64>, pub release_date: Option<i64>,
added_by: Uuid, // this shouldn't be exposed to randos added_by: Uuid, // this shouldn't be exposed to randos
created_at: i64, created_at: i64,