Admin dashboard and sessions

This commit is contained in:
Alphonse Paix
2025-09-01 03:08:43 +02:00
parent de1fc4a825
commit 6f6e6ab017
23 changed files with 809 additions and 56 deletions

View File

@@ -87,7 +87,7 @@ pub async fn subscribe(
base_url,
..
}): State<AppState>,
Form(form): Form<FormData>,
Form(form): Form<SubscriptionFormData>,
) -> Result<Response, SubscribeError> {
let mut transaction = connection_pool
.begin()
@@ -195,15 +195,15 @@ Click <a href=\"{}\">here</a> to confirm your subscription.",
#[derive(Debug, Deserialize)]
#[allow(dead_code)]
pub struct FormData {
pub struct SubscriptionFormData {
name: String,
email: String,
}
impl TryFrom<FormData> for NewSubscriber {
impl TryFrom<SubscriptionFormData> for NewSubscriber {
type Error = String;
fn try_from(value: FormData) -> Result<Self, Self::Error> {
fn try_from(value: SubscriptionFormData) -> Result<Self, Self::Error> {
let name = SubscriberName::parse(value.name)?;
let email = SubscriberEmail::parse(value.email)?;
Ok(Self { name, email })