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, } #[get("/overboard/catalog")] pub async fn overboard_catalog( ctx: Data, req: HttpRequest, ) -> Result { let tcx = TemplateCtx::new(&ctx, &req).await?; let threads = Post::read_overboard_catalog(&ctx).await?; let template = OverboardCatalogTemplate { tcx, threads }; template_response(&template) }