Compare commits
3
Commits
main
...
3e1bd59aa3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3e1bd59aa3
|
||
|
|
0f15c141c6
|
||
|
|
dd04c79d7d
|
No files matched your search
Generated
+1
-1
@@ -3190,7 +3190,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "soaricarus_api"
|
name = "soaricarus_api"
|
||||||
version = "0.5.11"
|
version = "0.5.12"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"axum",
|
"axum",
|
||||||
"axum-extra",
|
"axum-extra",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "soaricarus_api"
|
name = "soaricarus_api"
|
||||||
version = "0.5.11"
|
version = "0.5.12"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
rust-version = "1.95"
|
rust-version = "1.95"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|||||||
@@ -19,6 +19,11 @@ Copy the `.env.docker.sample` file to `.env`. Ensure that the `ROOT_DIRECTORY` v
|
|||||||
and exists on the docker image's filesystem. The credentials for the database doesn't need to be
|
and exists on the docker image's filesystem. The credentials for the database doesn't need to be
|
||||||
changed for development, but if deploying it, it should be modified.
|
changed for development, but if deploying it, it should be modified.
|
||||||
|
|
||||||
|
### Authentication setup
|
||||||
|
Make sure the `SECRET_MAIN_KEY` variable in the `.env` file is at least **24** characters long
|
||||||
|
and it should match the same value as the `SECRET_KEY` variable from `soaricarus_auth`.
|
||||||
|
|
||||||
|
|
||||||
### S3 Setup
|
### S3 Setup
|
||||||
Using the copied `.env.docker.sample`, ensure that the following has been properly populated.
|
Using the copied `.env.docker.sample`, ensure that the following has been properly populated.
|
||||||
```
|
```
|
||||||
@@ -41,7 +46,7 @@ docker compose build --ssh default
|
|||||||
|
|
||||||
Bring it up
|
Bring it up
|
||||||
```
|
```
|
||||||
docker compose up -d --force-recreate
|
docker compose up
|
||||||
```
|
```
|
||||||
|
|
||||||
To view the OpenAPI spec, run the project and access `/swagger-ui`. If running through docker,
|
To view the OpenAPI spec, run the project and access `/swagger-ui`. If running through docker,
|
||||||
|
|||||||
+26
-6
@@ -11,6 +11,7 @@ pub mod request {
|
|||||||
#[derive(Debug, serde::Deserialize, serde::Serialize, utoipa::ToSchema)]
|
#[derive(Debug, serde::Deserialize, serde::Serialize, utoipa::ToSchema)]
|
||||||
pub struct Params {
|
pub struct Params {
|
||||||
pub id: Option<uuid::Uuid>,
|
pub id: Option<uuid::Uuid>,
|
||||||
|
pub song_id: Option<uuid::Uuid>,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -181,7 +182,8 @@ pub mod endpoint {
|
|||||||
get,
|
get,
|
||||||
path = super::super::endpoints::GETCOVERART,
|
path = super::super::endpoints::GETCOVERART,
|
||||||
params(
|
params(
|
||||||
("id" = uuid::Uuid, Path, description = "Cover art Id")
|
("id" = uuid::Uuid, Path, description = "Cover art Id"),
|
||||||
|
("song_id" = uuid::Uuid, Path, description = "Song Id")
|
||||||
),
|
),
|
||||||
responses(
|
responses(
|
||||||
(status = 200, description = "Cover art retrieved", body = super::response::get_coverart::Response),
|
(status = 200, description = "Cover art retrieved", body = super::response::get_coverart::Response),
|
||||||
@@ -201,7 +203,7 @@ pub mod endpoint {
|
|||||||
Some(id) => match repo::coverart::get_coverart(&pool, &id).await {
|
Some(id) => match repo::coverart::get_coverart(&pool, &id).await {
|
||||||
Ok(coverart) => {
|
Ok(coverart) => {
|
||||||
response.data.push(coverart);
|
response.data.push(coverart);
|
||||||
response.message = String::from(super::super::response::SUCCESSFUL);
|
response.message = super::super::response::SUCCESSFUL.to_string();
|
||||||
(axum::http::StatusCode::OK, axum::Json(response))
|
(axum::http::StatusCode::OK, axum::Json(response))
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
@@ -209,10 +211,28 @@ pub mod endpoint {
|
|||||||
(axum::http::StatusCode::BAD_REQUEST, axum::Json(response))
|
(axum::http::StatusCode::BAD_REQUEST, axum::Json(response))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
None => {
|
_ => match params.song_id {
|
||||||
response.message = String::from("Invalid parameters");
|
Some(song_id) => {
|
||||||
(axum::http::StatusCode::BAD_REQUEST, axum::Json(response))
|
match repo::coverart::get_coverart_with_song_id(&pool, &song_id).await {
|
||||||
}
|
Ok(coverart) => {
|
||||||
|
response.data.push(coverart);
|
||||||
|
response.message = super::super::response::SUCCESSFUL.to_string();
|
||||||
|
(axum::http::StatusCode::OK, axum::Json(response))
|
||||||
|
}
|
||||||
|
Err(err) => {
|
||||||
|
response.message = err.to_string();
|
||||||
|
(
|
||||||
|
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
|
||||||
|
axum::Json(response),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
None => {
|
||||||
|
response.message = "Invalid parameters".to_string();
|
||||||
|
(axum::http::StatusCode::BAD_REQUEST, axum::Json(response))
|
||||||
|
}
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user