This repository has been archived on 2025-09-28. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
nekrochan/src/web/overboard_catalog.rs
sneedmaster a2d093954d Nekrocuck
2025-09-28 12:59:09 +02:00

31 lines
730 B
Rust

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)
}