tweak endpoints
This commit is contained in:
parent
9505266ef9
commit
1e9d97bd19
2 changed files with 39 additions and 9 deletions
|
@ -1,3 +1,36 @@
|
||||||
|
use axum::{
|
||||||
|
extract::{Form, Path, State},
|
||||||
|
http::StatusCode,
|
||||||
|
response::{IntoResponse, Response},
|
||||||
|
};
|
||||||
|
use sqlx::{query_as, SqlitePool};
|
||||||
|
use uuid::Uuid;
|
||||||
|
|
||||||
|
use crate::{ShowKind, User, Watch};
|
||||||
|
|
||||||
|
//-************************************************************************
|
||||||
|
// Error types for Watch creation
|
||||||
|
//-************************************************************************
|
||||||
|
|
||||||
|
#[Error]
|
||||||
|
pub struct WatchAddError(#[from] WatchAddErrorKind);
|
||||||
|
|
||||||
|
#[Error]
|
||||||
|
#[non_exhaustive]
|
||||||
|
pub enum WatchAddErrorKind {
|
||||||
|
UnknownDBError,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl IntoResponse for WatchAddError {
|
||||||
|
fn into_response(self) -> Response {
|
||||||
|
match self.0 {
|
||||||
|
WatchAddErrorKind::UnknownDBError => {
|
||||||
|
(StatusCode::INTERNAL_SERVER_ERROR, format!("{self}")).into_response()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Add a Watch to the whole system
|
/// Add a Watch to the whole system
|
||||||
pub async fn post_add_watch() {}
|
pub async fn post_add_watch() {}
|
||||||
|
|
||||||
|
@ -5,10 +38,8 @@ pub async fn post_add_watch() {}
|
||||||
pub async fn get_watch() {}
|
pub async fn get_watch() {}
|
||||||
|
|
||||||
/// everything the user has saved
|
/// everything the user has saved
|
||||||
pub async fn get_my_watches() {}
|
|
||||||
|
|
||||||
/// Add a Watch to user's to-watch list
|
|
||||||
pub async fn post_add_to_mine() {}
|
|
||||||
|
|
||||||
/// list of all watches?
|
|
||||||
pub async fn get_watches() {}
|
pub async fn get_watches() {}
|
||||||
|
|
||||||
|
pub async fn get_search_watch() {}
|
||||||
|
|
||||||
|
pub async fn post_search_watch() {}
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
mod handlers;
|
pub mod handlers;
|
||||||
|
pub mod templates;
|
||||||
pub use handlers::*;
|
|
||||||
|
|
||||||
#[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,
|
||||||
|
|
Loading…
Reference in a new issue