Added new status and made changes to song queue status code
This commit is contained in:
@@ -5,7 +5,7 @@ CREATE EXTENSION IF NOT EXISTS pgcrypto;
|
|||||||
CREATE TABLE IF NOT EXISTS "songQueue" (
|
CREATE TABLE IF NOT EXISTS "songQueue" (
|
||||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||||
filename TEXT NOT NULL,
|
filename TEXT NOT NULL,
|
||||||
status TEXT CHECK (status IN ('pending', 'processing', 'done')),
|
status TEXT CHECK (status IN ('pending', 'ready', 'processing', 'done')),
|
||||||
data BYTEA NULL
|
data BYTEA NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -148,11 +148,12 @@ pub mod response {
|
|||||||
|
|
||||||
pub mod status {
|
pub mod status {
|
||||||
pub const PENDING: &str = "pending";
|
pub const PENDING: &str = "pending";
|
||||||
|
pub const READY: &str = "ready";
|
||||||
pub const PROCESSING: &str = "processing";
|
pub const PROCESSING: &str = "processing";
|
||||||
pub const DONE: &str = "done";
|
pub const DONE: &str = "done";
|
||||||
|
|
||||||
pub async fn is_valid(status: &str) -> bool {
|
pub async fn is_valid(status: &str) -> bool {
|
||||||
status == PENDING || status == PROCESSING || status == DONE
|
status == PENDING || status == PROCESSING || status == DONE || status == READY
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -396,7 +397,7 @@ mod song_queue {
|
|||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.bind(super::status::PROCESSING)
|
.bind(super::status::PROCESSING)
|
||||||
.bind(super::status::PENDING)
|
.bind(super::status::READY)
|
||||||
.fetch_one(pool)
|
.fetch_one(pool)
|
||||||
.await
|
.await
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
|
|||||||
Reference in New Issue
Block a user