Basic dashboard for newsletter issue and password systems

This commit is contained in:
Alphonse Paix
2025-09-17 01:47:03 +02:00
parent 626726d206
commit a3533bfde7
6 changed files with 272 additions and 36 deletions

View File

@@ -8,11 +8,10 @@ use anyhow::Context;
use axum::{
Extension, Form,
extract::State,
response::{Html, IntoResponse, Redirect, Response},
response::{IntoResponse, Redirect, Response},
};
use axum_messages::Messages;
use sqlx::{Executor, Postgres, Transaction};
use std::fmt::Write;
use uuid::Uuid;
#[derive(serde::Deserialize)]
@@ -23,19 +22,6 @@ pub struct BodyData {
idempotency_key: String,
}
pub async fn publish_newsletter_form(messages: Messages) -> Response {
let mut error_html = String::new();
for message in messages {
writeln!(error_html, "<p><i>{}</i></p>", message).unwrap();
}
let idempotency_key = Uuid::new_v4();
Html(format!(
include_str!("html/send_newsletter_form.html"),
idempotency_key, error_html
))
.into_response()
}
#[tracing::instrument(skip_all)]
pub async fn insert_newsletter_issue(
transaction: &mut Transaction<'static, Postgres>,