Nekrocuck
This commit is contained in:
30
src/web/overboard_catalog.rs
Normal file
30
src/web/overboard_catalog.rs
Normal file
@@ -0,0 +1,30 @@
|
||||
use actix_web::{get, web::Data, HttpRequest, HttpResponse};
|
||||
use askama::Template;
|
||||
|
||||
use crate::{
|
||||
ctx::Ctx,
|
||||
db::models::Post,
|
||||
error::NekrochanError,
|
||||
filters,
|
||||
web::{tcx::TemplateCtx, template_response},
|
||||
};
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "overboard-catalog.html")]
|
||||
struct OverboardCatalogTemplate {
|
||||
tcx: TemplateCtx,
|
||||
threads: Vec<Post>,
|
||||
}
|
||||
|
||||
#[get("/overboard/catalog")]
|
||||
pub async fn overboard_catalog(
|
||||
ctx: Data<Ctx>,
|
||||
req: HttpRequest,
|
||||
) -> Result<HttpResponse, NekrochanError> {
|
||||
let tcx = TemplateCtx::new(&ctx, &req).await?;
|
||||
let threads = Post::read_overboard_catalog(&ctx).await?;
|
||||
|
||||
let template = OverboardCatalogTemplate { tcx, threads };
|
||||
|
||||
template_response(&template)
|
||||
}
|
||||
Reference in New Issue
Block a user