Changes to status definition

This commit is contained in:
kdeng00
2025-05-20 19:34:31 -04:00
parent b1f5c5f604
commit 2a273a52c5
+19 -10
View File
@@ -27,16 +27,25 @@ pub mod response {
}
}
pub mod status {
pub const PENDING: &str = "pending";
// Will be used later on
pub const PROCESSING: &str = "processing";
pub const DONE: &str = "done";
pub async fn is_valid(status: &str) -> bool {
if status == PENDING || status == PROCESSING || status == DONE {
true
} else {
false
}
}
}
mod song_queue {
use sqlx::Row;
pub mod status {
pub const PENDING: &str = "pending";
// Will be used later on
pub const PROCESSING: &str = "processing";
pub const _DONE: &str = "done";
}
#[derive(Debug, serde::Serialize, sqlx::FromRow)]
pub struct InsertedData {
pub id: uuid::Uuid,
@@ -96,8 +105,8 @@ mod song_queue {
RETURNING id, filename, status;
"#,
)
.bind(status::PROCESSING)
.bind(status::PENDING)
.bind(super::status::PROCESSING)
.bind(super::status::PENDING)
.fetch_one(pool)
.await
.map_err(|e| {
@@ -186,7 +195,7 @@ pub mod endpoint {
&pool,
&raw_data,
&file_name,
&song_queue::status::PENDING.to_string(),
&super::status::PENDING.to_string(),
)
.await
.unwrap();