Skip to content

Commit

Permalink
Fmt+Lint.
Browse files Browse the repository at this point in the history
  • Loading branch information
kirkbyers committed Mar 21, 2024
1 parent 7d89c4c commit 71ea96e
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/routes/subscriptions.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use actix_web::{web, HttpResponse};
use chrono::Utc;
use serde::Deserialize;
use uuid::Uuid;
use chrono::Utc;

#[derive(Deserialize)]
#[allow(dead_code)]
Expand All @@ -10,7 +10,6 @@ pub struct SubscriberData {
name: String,
}


const INSERT_QUERY: &str = r#"
INSERT INTO subscriptions (id, email, name, subscribed_at)
VALUES (?1, ?2, ?3, ?4);
Expand All @@ -27,14 +26,18 @@ pub async fn subscribe(
.await
.expect("Failed to prepare query.");
match stmt
.execute((id.to_string(), json.email.clone(), json.name.clone(), now.to_rfc3339()))
.await {
Ok(_) => {
HttpResponse::Ok().finish()
},
.execute((
id.to_string(),
json.email.clone(),
json.name.clone(),
now.to_rfc3339(),
))
.await
{
Ok(_) => HttpResponse::Ok().finish(),
Err(e) => {
eprintln!("Failed to execute query: {:?}", e);
return HttpResponse::InternalServerError().finish();
HttpResponse::InternalServerError().finish()
}
}
}

0 comments on commit 71ea96e

Please sign in to comment.