diff --git a/src/routes/newsletters.rs b/src/routes/newsletters.rs index aba10ad..84df182 100644 --- a/src/routes/newsletters.rs +++ b/src/routes/newsletters.rs @@ -1,5 +1,17 @@ -use actix_web::HttpResponse; +use actix_web::{web, HttpResponse}; -pub async fn publish_newsletter() -> HttpResponse { +#[derive(serde::Serialize)] +pub struct BodyData { + title: String, + content: Content, +} + +#[derive(serde::Serialize)] +pub struct Content { + html: String, + text: String, +} + +pub async fn publish_newsletter(_body: web::Json) -> HttpResponse { HttpResponse::Ok().finish() } diff --git a/tests/api/newsletter.rs b/tests/api/newsletter.rs index 9ad5fcf..576aa14 100644 --- a/tests/api/newsletter.rs +++ b/tests/api/newsletter.rs @@ -1,5 +1,5 @@ use crate::helpers::{spawn_app, ConfirmationLinks, TestApp}; -use wiremock::matchers::{method, path, any}; +use wiremock::matchers::{any, method, path}; use wiremock::{Mock, ResponseTemplate}; async fn create_unconfirmed_subscriber(app: &TestApp) -> ConfirmationLinks { @@ -51,7 +51,7 @@ async fn newsletters_are_not_delivered_to_unconfirmed_subscribers() { // Act let newsletter_request_body = serde_json::json!({ "title": "Newsletter title", - "body": { + "content": { "text": "Newsletter body as plain text", "html": "

Newsletter body as HTML

", } @@ -84,7 +84,7 @@ async fn newsletters_are_delivered_to_confirmed_subscribers() { // Act let newsletter_request_body = serde_json::json!({ "title": "Newsletter title", - "body": { + "content": { "text": "Newsletter body as plain text", "html": "

Newsletter body as HTML

", }