bookforge/src/routes/book.rs

57 lines
1.2 KiB
Rust
Raw Normal View History

2026-01-23 13:56:30 +01:00
use askama::Template;
use askama_web::WebTemplate;
use axum::extract::Path;
2026-01-26 01:05:10 +01:00
use crate::state::error::AppStateError;
2026-01-23 13:56:30 +01:00
#[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 {})
}