Added callers moulde #120

Merged
kdeng00 merged 44 commits from add_queue_endpoint into v0.2 2025-04-22 20:08:24 -04:00
3 changed files with 6 additions and 23 deletions
Showing only changes of commit 227cd926ca - Show all commits
+1 -7
View File
@@ -24,11 +24,5 @@ icarus_meta = { git = "ssh://git@git.kundeng.us/phoenix/icarus_meta.git", tag =
icarus_models = { git = "ssh://git@git.kundeng.us/phoenix/icarus_models.git", tag = "v0.4.3" }
[dev-dependencies]
http-body-util = { version = "0.1.3" }
common-multipart-rfc7578 = { version = "0.7.0" }
anyhow = { version = "1.0.98" }
url = { version = "2.5.4" }
reqwest = { version = "0.12.15", features = ["stream", "multipart"] }
axum-test = { version = "17.3.0" }
hyper = { version = "1.6.0" }
base64 = "0.22.1"
url = { version = "2.5.4" }
+5 -6
View File
@@ -58,7 +58,6 @@ mod song_queue {
pub mod endpoint {
use axum::{Json, http::StatusCode};
// use axum::extract::M
use std::io::Write;
use crate::callers::song::song_queue;
@@ -66,7 +65,6 @@ pub mod endpoint {
pub async fn queue_song(
axum::Extension(pool): axum::Extension<sqlx::PgPool>,
mut multipart: axum::extract::Multipart,
// Json(payload): Json<super::request::Request>,
) -> (StatusCode, Json<super::response::Response>) {
let mut results: Vec<uuid::Uuid> = Vec::new();
let mut response = super::response::Response::default();
@@ -75,10 +73,6 @@ pub mod endpoint {
let name = field.name().unwrap().to_string();
let file_name = field.file_name().unwrap().to_string();
let content_type = field.content_type().unwrap().to_string();
println!(
"Name {} filename {} content type {}",
name, file_name, content_type
);
let data = field.bytes().await.unwrap();
println!(
@@ -101,6 +95,11 @@ pub mod endpoint {
}
response.data = results;
response.message = if response.data.is_empty() {
String::from("Error")
} else {
String::from("Success")
};
(StatusCode::OK, Json(response))
}
-10
View File
@@ -1,5 +1,3 @@
// use serde::{Deserialize, Serialize};
pub mod callers;
pub mod db {
@@ -19,8 +17,6 @@ pub mod db {
}
}
// use crate::{connection_settings, keys};
pub async fn create_pool() -> Result<sqlx::PgPool, sqlx::Error> {
let database_url = get_db_url().await;
println!("Database url: {:?}", database_url);
@@ -32,7 +28,6 @@ pub mod db {
}
async fn get_db_url() -> String {
// #[cfg(debug_assertions)] // Example: Only load .env in debug builds
dotenvy::dotenv().ok();
env::var(keys::DBURL).expect(keys::error::ERROR)
}
@@ -57,11 +52,7 @@ async fn main() {
// build our application with a route
let app = init::app().await;
// `GET /` goes to `root`
// `POST /users` goes to `create_user`
// .route("/users", post(create_user));
// run our app with hyper, listening globally on port 3000
let listener = tokio::net::TcpListener::bind(get_full()).await.unwrap();
axum::serve(listener, app).await.unwrap();
}
@@ -73,7 +64,6 @@ pub mod init {
pub async fn routes() -> axum::Router {
axum::Router::new()
// `GET /` goes to `root`
.route(crate::ROOT, get(crate::root))
.route(
crate::callers::endpoints::QUEUESONG,