Fix date issue

This commit is contained in:
kdeng00
2025-04-29 21:04:27 -04:00
parent ccbb82c643
commit 1d4db581b1
+13 -9
View File
@@ -80,7 +80,8 @@ pub mod metadata_queue {
pub struct MetadataQueue { pub struct MetadataQueue {
pub id: uuid::Uuid, pub id: uuid::Uuid,
// pub metadata: serde_json::Value, // pub metadata: serde_json::Value,
pub metadata: serde_json::Value, // pub metadata: serde_json::Value,
#[serde(with = "time::serde::rfc3339")]
pub created_at: time::OffsetDateTime, pub created_at: time::OffsetDateTime,
pub song_queue_id: uuid::Uuid, pub song_queue_id: uuid::Uuid,
} }
@@ -137,10 +138,10 @@ pub mod metadata_queue {
.try_get("id") .try_get("id")
.map_err(|_e| sqlx::Error::RowNotFound) .map_err(|_e| sqlx::Error::RowNotFound)
.unwrap(), .unwrap(),
metadata: row // metadata: row
.try_get("metadata") // .try_get("metadata")
.map_err(|_e| sqlx::Error::RowNotFound) // .map_err(|_e| sqlx::Error::RowNotFound)
.unwrap(), // .unwrap(),
created_at: row created_at: row
.try_get("created_at") .try_get("created_at")
.map_err(|_e| sqlx::Error::RowNotFound) .map_err(|_e| sqlx::Error::RowNotFound)
@@ -178,10 +179,10 @@ pub mod metadata_queue {
.try_get("id") .try_get("id")
.map_err(|_e| sqlx::Error::RowNotFound) .map_err(|_e| sqlx::Error::RowNotFound)
.unwrap(), .unwrap(),
metadata: row // metadata: row
.try_get("metadata") // .try_get("metadata")
.map_err(|_e| sqlx::Error::RowNotFound) // .map_err(|_e| sqlx::Error::RowNotFound)
.unwrap(), // .unwrap(),
// serde_json::Value::new(), // serde_json::Value::new(),
created_at: row created_at: row
.try_get("created_at") .try_get("created_at")
@@ -238,6 +239,8 @@ pub mod endpoint {
println!("Something works {:?} {:?}", id, song_queue_id); println!("Something works {:?} {:?}", id, song_queue_id);
if !id.is_nil() { if !id.is_nil() {
println!("Id is not nil");
match super::metadata_queue::get_with_id(&pool, &id).await { match super::metadata_queue::get_with_id(&pool, &id).await {
Ok(item) => { Ok(item) => {
response.message = String::from("Successful"); response.message = String::from("Successful");
@@ -250,6 +253,7 @@ pub mod endpoint {
} }
} }
} else { } else {
println!("Song queue Id is probably not nil");
match super::metadata_queue::get_with_song_queue_id(&pool, &song_queue_id).await match super::metadata_queue::get_with_song_queue_id(&pool, &song_queue_id).await
{ {
Ok(item) => { Ok(item) => {