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
create table if not exists watches (
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,
metadata_url text, -- possible url for imdb or other metadata-esque site to show the user
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 login::{get_login, get_logout, post_login, post_logout};
use signup::{get_create_user, handle_signup_success, post_create_user};
use watches::handlers::{
get_search_watch, get_watches, post_add_watch, post_search_watch, put_add_watch,
};
use watches::handlers::{get_search_watch, get_watches, post_add_watch};
axum::Router::new()
.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("/watch", get(get_watch))
.route("/watch/:id", get(get_watch))
.route("/search", get(get_search_watch).post(post_search_watch))
.route(
"/add",
get(get_search_watch)
.put(put_add_watch)
.post(post_add_watch),
)
.route("/search", get(get_search_watch))
.route("/add", get(get_search_watch).post(post_add_watch))
.fallback(handle_slash_redir)
.layer(middleware::from_fn_with_state(
db_pool.clone(),

View file

@ -74,11 +74,8 @@ impl Default for SearchQuery {
// 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() {}
/// Add a Watch to your watchlist (side effects system-add if missing)
pub async fn post_add_watch() -> impl IntoResponse {}
/// A single 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(
Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize, sqlx::Type,
)]
#[repr(i32)]
#[repr(i64)]
pub enum ShowKind {
Movie = 0,
Series = 1,
@ -18,7 +18,14 @@ pub enum ShowKind {
impl std::fmt::Display for ShowKind {
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 {
fn from(value: i32) -> Self {
impl From<i64> for ShowKind {
fn from(value: i64) -> Self {
match value {
0 => Self::Movie,
1 => Self::Series,
@ -59,7 +66,7 @@ pub struct Watch {
pub kind: ShowKind,
pub title: String,
pub metadata_url: Option<String>,
pub length: Option<i32>,
pub length: Option<i64>,
pub release_date: Option<i64>,
added_by: Uuid, // this shouldn't be exposed to randos
created_at: i64,