add publish skeleton

This commit is contained in:
azdle 2025-07-16 10:08:41 -05:00
parent ca21a84725
commit b5dec9c793

View file

@ -18,6 +18,7 @@ pub fn build() -> Router<AppState> {
Router::new()
.route("/", post(subscribe))
.route("/confirm/", get(confirm))
.route("/publish/", post(publish))
}
#[derive(Deserialize)]
@ -166,3 +167,29 @@ impl IntoResponse for ConfirmError {
.into_response()
}
}
pub async fn publish(// State(AppState { db, .. }): State<AppState>,
// Query(query): Query<PublishQuery>,
) -> Result<(), PublishError> {
info!("publish");
Ok(())
}
#[derive(thiserror::Error, Debug)]
pub enum PublishError {
#[error("Unknown Error: {0}")]
Unknown(#[from] anyhow::Error),
}
impl IntoResponse for PublishError {
fn into_response(self) -> axum::response::Response {
match self {
PublishError::Unknown(e) => {
error!(?e, "returning INTERNAL SERVER ERROR");
(StatusCode::INTERNAL_SERVER_ERROR, "Unknown Error")
}
}
.into_response()
}
}