Compare commits
3
Commits
389f526fa1
...
41481effe3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
41481effe3
|
||
|
|
49da44b5e4
|
||
|
|
b786a8c616
|
Generated
+1
-1
@@ -3022,7 +3022,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "soaricarus_api"
|
||||
version = "0.5.3"
|
||||
version = "0.5.4"
|
||||
dependencies = [
|
||||
"axum",
|
||||
"axum-extra",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "soaricarus_api"
|
||||
version = "0.5.3"
|
||||
version = "0.5.4"
|
||||
edition = "2024"
|
||||
rust-version = "1.95"
|
||||
license = "MIT"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2025 Kun Deng
|
||||
Copyright (c) 2026 Kun Deng
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -160,7 +160,6 @@ pub mod endpoint {
|
||||
match super::is_song_valid(&raw_data).await {
|
||||
Ok(valid) => {
|
||||
if valid {
|
||||
println!("Go");
|
||||
match repo::song::insert(
|
||||
&pool,
|
||||
&file_name,
|
||||
@@ -179,23 +178,13 @@ pub mod endpoint {
|
||||
raw_data: copied_raw_data,
|
||||
..Default::default()
|
||||
};
|
||||
/*
|
||||
let filename = simodels::song::generate_filename(
|
||||
simodels::types::MusicType::FlacExtension,
|
||||
true,
|
||||
)
|
||||
.unwrap();
|
||||
*/
|
||||
|
||||
println!("Filename: {file_name:?}");
|
||||
let file_path = format!("queued/song/{file_name}");
|
||||
println!("Path: {file_path:?}");
|
||||
|
||||
match lr.upload(&file_path, &data).await {
|
||||
Ok(res) => {
|
||||
println!("Result: {res:?}");
|
||||
|
||||
println!("Saving to db");
|
||||
|
||||
Ok(_res) => {
|
||||
match repo::data::insert(
|
||||
&pool,
|
||||
&file_path,
|
||||
|
||||
@@ -251,53 +251,3 @@ pub async fn get_song_queue(
|
||||
Err(_err) => Err(sqlx::Error::RowNotFound),
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
pub async fn wipe_data(pool: &sqlx::PgPool, id: &uuid::Uuid) -> Result<uuid::Uuid, sqlx::Error> {
|
||||
let result = sqlx::query(
|
||||
r#"
|
||||
UPDATE "songQueue" SET data = NULL WHERE id = $1 RETURNING id;
|
||||
"#,
|
||||
)
|
||||
.bind(id)
|
||||
.fetch_one(pool)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
eprintln!("Error updating record: {e}");
|
||||
});
|
||||
|
||||
match result {
|
||||
Ok(row) => Ok(row
|
||||
.try_get("id")
|
||||
.map_err(|_e| sqlx::Error::RowNotFound)
|
||||
.unwrap()),
|
||||
Err(_) => Err(sqlx::Error::RowNotFound),
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn get_data(pool: &sqlx::PgPool, id: &uuid::Uuid) -> Result<Vec<u8>, sqlx::Error> {
|
||||
let result = sqlx::query(
|
||||
r#"
|
||||
SELECT data FROM "songQueue"
|
||||
WHERE id = $1;
|
||||
"#,
|
||||
)
|
||||
.bind(id)
|
||||
.fetch_one(pool)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
eprintln!("Error inserting: {e}");
|
||||
});
|
||||
|
||||
match result {
|
||||
Ok(row) => {
|
||||
let data = row
|
||||
.try_get("data")
|
||||
.map_err(|_e| sqlx::Error::RowNotFound)
|
||||
.unwrap();
|
||||
Ok(data)
|
||||
}
|
||||
Err(_err) => Err(sqlx::Error::RowNotFound),
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user