cargo fmt

This commit is contained in:
2026-06-19 16:40:24 -04:00
parent 8b9acd3491
commit 983528ba62
2 changed files with 25 additions and 18 deletions
+15 -7
View File
@@ -46,7 +46,7 @@ pub mod request {
#[derive(Debug, Default, Deserialize, Serialize, ToSchema)]
pub struct UpdateScheduledMessageStatusRequest {
pub status: String,
pub scheduled_message_id: uuid::Uuid
pub scheduled_message_id: uuid::Uuid,
}
impl UpdateScheduledMessageStatusRequest {
@@ -259,18 +259,26 @@ pub mod endpoint {
match scheduling_repo::get(&pool, &payload.scheduled_message_id).await {
Ok(scheduled_message) => {
let old_status = scheduled_message.status;
match scheduling_repo::update_status(&pool, &scheduled_message.id, &payload.status).await {
match scheduling_repo::update_status(
&pool,
&scheduled_message.id,
&payload.status,
)
.await
{
Ok(_) => {
response.message = String::from(super::super::super::response::SUCCESSFUL);
response.data = vec![super::response::ChangedStatus {
old_status,
}];
response.message =
String::from(super::super::super::response::SUCCESSFUL);
response.data = vec![super::response::ChangedStatus { old_status }];
(axum::http::StatusCode::OK, axum::Json(response))
}
Err(err) => {
eprintln!("Error: {err:?}");
response.message = String::from("Invalid");
(axum::http::StatusCode::INTERNAL_SERVER_ERROR, axum::Json(response))
(
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
axum::Json(response),
)
}
}
}
+10 -11
View File
@@ -88,21 +88,20 @@ pub async fn update_status(
pool: &sqlx::PgPool,
id: &uuid::Uuid,
status: &str,
) -> Result<(), sqlx::Error> {
) -> Result<(), sqlx::Error> {
match sqlx::query(
r#"
UPDATE "scheduled_message" SET status = $1 WHERE id = $2;
"#,
)
.bind(status)
.bind(id)
.execute(pool)
.await {
Ok(_row) => {
Ok(())
}
Err(err) => Err(err)
}
)
.bind(status)
.bind(id)
.execute(pool)
.await
{
Ok(_row) => Ok(()),
Err(err) => Err(err),
}
}
async fn parse_row(