add publish skeleton
This commit is contained in:
parent
ca21a84725
commit
b5dec9c793
1 changed files with 27 additions and 0 deletions
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue