Initial Commit
This commit is contained in:
commit
e8529bdbee
25 changed files with 13519 additions and 0 deletions
57
src/routes/book.rs
Normal file
57
src/routes/book.rs
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
use askama::Template;
|
||||
use askama_web::WebTemplate;
|
||||
use axum::extract::Path;
|
||||
|
||||
use crate::error::AppStateError;
|
||||
|
||||
#[derive(Template, WebTemplate)]
|
||||
#[template(path = "index.html")]
|
||||
struct BookIndexTemplate {}
|
||||
|
||||
pub async fn index() -> Result<impl axum::response::IntoResponse, AppStateError> {
|
||||
if 0 > 1 {
|
||||
return Err(AppStateError::Error);
|
||||
}
|
||||
|
||||
Ok(BookIndexTemplate {})
|
||||
}
|
||||
|
||||
#[derive(Template, WebTemplate)]
|
||||
#[template(path = "books/show.html")]
|
||||
struct ShowBookTemplate {}
|
||||
|
||||
pub async fn show(
|
||||
Path(_id): Path<i32>,
|
||||
) -> Result<impl axum::response::IntoResponse, AppStateError> {
|
||||
if 0 > 1 {
|
||||
return Err(AppStateError::Error);
|
||||
}
|
||||
|
||||
Ok(ShowBookTemplate {})
|
||||
}
|
||||
|
||||
#[derive(Template, WebTemplate)]
|
||||
#[template(path = "books/new.html")]
|
||||
struct NewBookTemplate {}
|
||||
|
||||
pub async fn new() -> Result<impl axum::response::IntoResponse, AppStateError> {
|
||||
if 0 > 1 {
|
||||
return Err(AppStateError::Error);
|
||||
}
|
||||
|
||||
Ok(NewBookTemplate {})
|
||||
}
|
||||
|
||||
#[derive(Template, WebTemplate)]
|
||||
#[template(path = "books/edit.html")]
|
||||
struct EditBookTemplate {}
|
||||
|
||||
pub async fn edit(
|
||||
Path(_id): Path<i32>,
|
||||
) -> Result<impl axum::response::IntoResponse, AppStateError> {
|
||||
if 0 > 1 {
|
||||
return Err(AppStateError::Error);
|
||||
}
|
||||
|
||||
Ok(EditBookTemplate {})
|
||||
}
|
||||
Loading…
Reference in a new issue