Compare commits
5
Commits
v0.5.11
...
3e1bd59aa3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3e1bd59aa3
|
||
|
|
0f15c141c6
|
||
|
|
dd04c79d7d
|
||
|
|
728948ebe4 | ||
|
|
4f9a51fcf0 |
No files matched your search
Generated
+28
-27
@@ -704,9 +704,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cc"
|
name = "cc"
|
||||||
version = "1.10.0"
|
version = "1.11.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "86e055fa6e3e40ad6187ba25b6855eeb635d5271f8e0f0e1e9a5826b8d75bea0"
|
checksum = "375989decec1a0fa424442bed520fa12ede43a48475ce8c7417d2c69b32b5f6b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"find-msvc-tools",
|
"find-msvc-tools",
|
||||||
"jobserver",
|
"jobserver",
|
||||||
@@ -896,9 +896,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "crc32fast"
|
name = "crc32fast"
|
||||||
version = "1.5.3"
|
version = "1.5.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0ba106e844045ddc02c20768ac4b0b7cb45f2cc2ecbd833ac9f5dacb183c2055"
|
checksum = "5f97d3416d5337d15c4b0d78c8c91df922ca143f57ec20e2d1c188333047ef04"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
]
|
]
|
||||||
@@ -969,9 +969,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ctutils"
|
name = "ctutils"
|
||||||
version = "0.4.7"
|
version = "0.4.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a2376ffd6f96d8a9db59875b4b6b0237d6900b5baf64279714e05493ce64828a"
|
checksum = "261af4dc7a06ea8a527a8717d8cbba3417530d6ea14e1edb3de6b67806be474f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cmov",
|
"cmov",
|
||||||
"subtle",
|
"subtle",
|
||||||
@@ -2027,8 +2027,8 @@ checksum = "a4933f3f57a8e9d9da04db23fb153356ecaf00cbd14aee46279c33dc80925c37"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "labyrinth"
|
name = "labyrinth"
|
||||||
version = "0.0.6"
|
version = "0.0.8"
|
||||||
source = "git+ssh://git@git.kundeng.us/phoenix/labyrinth.git?tag=v0.0.6#b9a40a20ddf94386e01a1081faac302bbda96f62"
|
source = "git+ssh://git@git.kundeng.us/phoenix/labyrinth.git?tag=v0.0.8#cf46c3f68a9f173fe8daaed6407882e933458f8f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aws-config",
|
"aws-config",
|
||||||
"aws-sdk-s3",
|
"aws-sdk-s3",
|
||||||
@@ -2117,9 +2117,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "log"
|
name = "log"
|
||||||
version = "0.4.34"
|
version = "0.4.35"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6"
|
checksum = "5d15f86d12da44cd8d4ec3c73984537eb7f4cadcb9776a575a0a8a05ca11005c"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lru"
|
name = "lru"
|
||||||
@@ -2154,9 +2154,9 @@ checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mime"
|
name = "mime"
|
||||||
version = "0.3.17"
|
version = "0.3.18"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"
|
checksum = "d5848f5a9e8117cf94f2f90faac24a87ff81600ff8628c1e3deaab572e76bfa1"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mime_guess"
|
name = "mime_guess"
|
||||||
@@ -2328,9 +2328,9 @@ checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "openssl"
|
name = "openssl"
|
||||||
version = "0.10.81"
|
version = "0.10.82"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "77823a27f0babb03091cb9ed9ef80af3b39dbc82f97e8fa530374b7dafd87a45"
|
checksum = "4de8111e94a56adca7ebfe6c365b6d42f99deb69b74b6becacd4204e2f193aa2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
@@ -2368,9 +2368,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "openssl-sys"
|
name = "openssl-sys"
|
||||||
version = "0.9.117"
|
version = "0.9.118"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b47e7e6bb2c38cd930d25a23b40fa52e068c10e85f3e03a7f5ba5aaca5713695"
|
checksum = "19c413d6ec9ebaf5e1c829d355cb3e9f783778d700f135be0921d52fce3c60ae"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc",
|
"cc",
|
||||||
"libc",
|
"libc",
|
||||||
@@ -3087,8 +3087,8 @@ checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sienvy"
|
name = "sienvy"
|
||||||
version = "0.8.2"
|
version = "0.8.3"
|
||||||
source = "git+ssh://git@git.kundeng.us/phoenix/sienvy.git?tag=v0.8.2#492c3e04d1b3f49fcdfe4af71ce0686fa4649526"
|
source = "git+ssh://git@git.kundeng.us/phoenix/sienvy.git?tag=v0.8.3#71544fd2e8d217eac5fc51b14bb062c302465718"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"const_format",
|
"const_format",
|
||||||
"dotenvy",
|
"dotenvy",
|
||||||
@@ -3138,8 +3138,8 @@ checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "simeta"
|
name = "simeta"
|
||||||
version = "0.6.3"
|
version = "0.6.4"
|
||||||
source = "git+ssh://git@git.kundeng.us/phoenix/simeta.git?tag=v0.6.3#1bec08de7cb6533e7d9ddb89a00c7d34667f156c"
|
source = "git+ssh://git@git.kundeng.us/phoenix/simeta.git?tag=v0.6.4#1c0ad7983d2eab20de9e724105e8f894f8fb871f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"imghdr",
|
"imghdr",
|
||||||
"infer",
|
"infer",
|
||||||
@@ -3149,8 +3149,8 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "simodels"
|
name = "simodels"
|
||||||
version = "0.11.7"
|
version = "0.11.9"
|
||||||
source = "git+ssh://git@git.kundeng.us/phoenix/simodels.git?tag=v0.11.7#6022347cb762b413bb59b975619577a45d26383f"
|
source = "git+ssh://git@git.kundeng.us/phoenix/simodels.git?tag=v0.11.9#8e91af657e2e1f124bbba9547ee7e6936f6bb249"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"josekit",
|
"josekit",
|
||||||
"rand 0.10.3",
|
"rand 0.10.3",
|
||||||
@@ -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",
|
||||||
@@ -3852,9 +3852,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-properties"
|
name = "unicode-properties"
|
||||||
version = "0.1.4"
|
version = "0.1.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7df058c713841ad818f1dc5d3fd88063241cc61f49f5fbea4b951e8cf5a8d71d"
|
checksum = "993ad287eb20e8ba755312801cfe1413e0f25d604075863acaddca10b04c1833"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-xid"
|
name = "unicode-xid"
|
||||||
@@ -4285,14 +4285,15 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zip"
|
name = "zip"
|
||||||
version = "9.1.3"
|
version = "9.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1156b39d142a34b999c2310a50455e0cb3760bf7efad0122f796d813bee26ccb"
|
checksum = "3cec733c9820347a592f6375c3c0089b479ba0a0b1cbf3dd1958b02959b7c033"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"crc32fast",
|
"crc32fast",
|
||||||
"flate2",
|
"flate2",
|
||||||
"getrandom 0.4.3",
|
"getrandom 0.4.3",
|
||||||
"indexmap",
|
"indexmap",
|
||||||
|
"libc",
|
||||||
"memchr",
|
"memchr",
|
||||||
"nix",
|
"nix",
|
||||||
"typed-path",
|
"typed-path",
|
||||||
|
|||||||
+6
-6
@@ -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"
|
||||||
@@ -9,7 +9,7 @@ description = "Core API for interacting with soaricarus"
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
axum = { version = "0.8.9", features = ["multipart"] }
|
axum = { version = "0.8.9", features = ["multipart"] }
|
||||||
axum-extra = { version = "0.12.6", features = ["cookie"] }
|
axum-extra = { version = "0.12.6", features = ["cookie"] }
|
||||||
openssl = { version = "0.10.81", features = ["vendored"] }
|
openssl = { version = "0.10.82", features = ["vendored"] }
|
||||||
serde = { version = "1.0.229", features = ["derive"] }
|
serde = { version = "1.0.229", features = ["derive"] }
|
||||||
serde_json = { version = "1.0.154" }
|
serde_json = { version = "1.0.154" }
|
||||||
tokio = { version = "1.54.1", features = ["full"] }
|
tokio = { version = "1.54.1", features = ["full"] }
|
||||||
@@ -26,10 +26,10 @@ jsonwebtoken = { version = "11.0.0", features = ["rust_crypto"] }
|
|||||||
josekit = { version = "0.10.3" }
|
josekit = { version = "0.10.3" }
|
||||||
utoipa = { version = "6.0.0", features = ["axum_extras"] }
|
utoipa = { version = "6.0.0", features = ["axum_extras"] }
|
||||||
utoipa-swagger-ui = { version = "10.0.2", features = ["axum"] }
|
utoipa-swagger-ui = { version = "10.0.2", features = ["axum"] }
|
||||||
simeta = { git = "ssh://git@git.kundeng.us/phoenix/simeta.git", tag = "v0.6.3" }
|
simeta = { git = "ssh://git@git.kundeng.us/phoenix/simeta.git", tag = "v0.6.4" }
|
||||||
simodels = { git = "ssh://git@git.kundeng.us/phoenix/simodels.git", tag = "v0.11.7" }
|
simodels = { git = "ssh://git@git.kundeng.us/phoenix/simodels.git", tag = "v0.11.9" }
|
||||||
sienvy = { git = "ssh://git@git.kundeng.us/phoenix/sienvy.git", tag = "v0.8.2" }
|
sienvy = { git = "ssh://git@git.kundeng.us/phoenix/sienvy.git", tag = "v0.8.3" }
|
||||||
labyrinth = { git = "ssh://git@git.kundeng.us/phoenix/labyrinth.git", tag = "v0.0.6" }
|
labyrinth = { git = "ssh://git@git.kundeng.us/phoenix/labyrinth.git", tag = "v0.0.8" }
|
||||||
|
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
+56
-7
@@ -18,6 +18,8 @@ services:
|
|||||||
condition: service_started
|
condition: service_started
|
||||||
auth_api:
|
auth_api:
|
||||||
condition: service_started
|
condition: service_started
|
||||||
|
logledger_api:
|
||||||
|
condition: service_started
|
||||||
networks:
|
networks:
|
||||||
- soaricarus-network
|
- soaricarus-network
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
@@ -43,6 +45,25 @@ services:
|
|||||||
# volumes:
|
# volumes:
|
||||||
# - ./path/to/your/web-api-repo:/app
|
# - ./path/to/your/web-api-repo:/app
|
||||||
|
|
||||||
|
logledger_api:
|
||||||
|
build:
|
||||||
|
context: ../logledger_api
|
||||||
|
ssh: ["default"]
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
container_name: logledger_api
|
||||||
|
ports:
|
||||||
|
- "8200:8200"
|
||||||
|
env_file:
|
||||||
|
- ../logledger_api/.env
|
||||||
|
depends_on:
|
||||||
|
logledger_db:
|
||||||
|
condition: service_healthy
|
||||||
|
volumes:
|
||||||
|
- logledger_data:/shared:ro # Mount as read-only
|
||||||
|
networks:
|
||||||
|
- soaricarus-network
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
# --- songparser service ---
|
# --- songparser service ---
|
||||||
songparser:
|
songparser:
|
||||||
build:
|
build:
|
||||||
@@ -77,23 +98,23 @@ services:
|
|||||||
GARAGE_S3_API_ROOT_DOMAIN: "${GARAGE_ROOT_DOMAIN}"
|
GARAGE_S3_API_ROOT_DOMAIN: "${GARAGE_ROOT_DOMAIN}"
|
||||||
GARAGE_ADMIN_BIND_ADDR: "0.0.0.0:3902"
|
GARAGE_ADMIN_BIND_ADDR: "0.0.0.0:3902"
|
||||||
GARAGE_ADMIN_PUBLIC_BIND_ADDR: "0.0.0.0:3902"
|
GARAGE_ADMIN_PUBLIC_BIND_ADDR: "0.0.0.0:3902"
|
||||||
|
|
||||||
# Cluster configuration (single node for simplicity)
|
# Cluster configuration (single node for simplicity)
|
||||||
GARAGE_CLUSTER_REPLICATION_MODE: "none" # Single node
|
GARAGE_CLUSTER_REPLICATION_MODE: "none" # Single node
|
||||||
GARAGE_CLUSTER_PEER_REPLICATION_STRATEGY: "ring"
|
GARAGE_CLUSTER_PEER_REPLICATION_STRATEGY: "ring"
|
||||||
|
|
||||||
# Data storage
|
# Data storage
|
||||||
GARAGE_DATA_DIR: "/data"
|
GARAGE_DATA_DIR: "/data"
|
||||||
GARAGE_METADATA_DIR: "/data/meta"
|
GARAGE_METADATA_DIR: "/data/meta"
|
||||||
|
|
||||||
# RPC configuration
|
# RPC configuration
|
||||||
GARAGE_RPC_PUBLIC_ADDR: "http://maze:3901"
|
GARAGE_RPC_PUBLIC_ADDR: "http://maze:3901"
|
||||||
GARAGE_RPC_BIND_ADDR: "0.0.0.0:3901"
|
GARAGE_RPC_BIND_ADDR: "0.0.0.0:3901"
|
||||||
GARAGE_RPC_SECRET: "${GARAGE_RPC_SECRET}" # 32+ chars
|
GARAGE_RPC_SECRET: "${GARAGE_RPC_SECRET}" # 32+ chars
|
||||||
|
|
||||||
# Web Admin
|
# Web Admin
|
||||||
GARAGE_ADMIN_TOKEN: "${GARAGE_ADMIN_TOKEN}"
|
GARAGE_ADMIN_TOKEN: "${GARAGE_ADMIN_TOKEN}"
|
||||||
|
|
||||||
# Logging
|
# Logging
|
||||||
GARAGE_LOG_LEVEL: "info"
|
GARAGE_LOG_LEVEL: "info"
|
||||||
|
|
||||||
@@ -107,8 +128,8 @@ services:
|
|||||||
AWS_ACCESS_KEY_ID: "${GARAGE_DEFAULT_ACCESS_KEY}"
|
AWS_ACCESS_KEY_ID: "${GARAGE_DEFAULT_ACCESS_KEY}"
|
||||||
AWS_SECRET_ACCESS_KEY: "${GARAGE_DEFAULT_SECRET_KEY}"
|
AWS_SECRET_ACCESS_KEY: "${GARAGE_DEFAULT_SECRET_KEY}"
|
||||||
AWS_DEFAULT_REGION: "${GARAGE_DEFAULT_BUCKET}"
|
AWS_DEFAULT_REGION: "${GARAGE_DEFAULT_BUCKET}"
|
||||||
AWS_S3_FORCE_PATH_STYLE: "true"
|
AWS_S3_FORCE_PATH_STYLE: "true"
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./garage.toml:/etc/garage.toml:ro # Mount config file
|
- ./garage.toml:/etc/garage.toml:ro # Mount config file
|
||||||
- shared_credentials:/data # Persist Garage data
|
- shared_credentials:/data # Persist Garage data
|
||||||
@@ -178,15 +199,43 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
- soaricarus-network
|
- soaricarus-network
|
||||||
|
|
||||||
|
logledger_db:
|
||||||
|
image: postgres:18.6-alpine
|
||||||
|
container_name: logledger_db
|
||||||
|
environment:
|
||||||
|
POSTGRES_USER: ${POSTGRES_LOG_USER:-logledger}
|
||||||
|
POSTGRES_PASSWORD: ${POSTGRES_LOG_PASSWORD:-password}
|
||||||
|
POSTGRES_DB: ${POSTGRES_LOG_DB:-logledger_db}
|
||||||
|
volumes:
|
||||||
|
# Persist database data using a named volume
|
||||||
|
- postgres_data_logledger:/var/lib/postgresql
|
||||||
|
ports:
|
||||||
|
- "5434:5432"
|
||||||
|
healthcheck:
|
||||||
|
# Checks if Postgres is ready to accept connections
|
||||||
|
test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"]
|
||||||
|
interval: 10s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
|
start_period: 10s
|
||||||
|
restart: always
|
||||||
|
networks:
|
||||||
|
- soaricarus-network
|
||||||
|
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
postgres_data:
|
postgres_data:
|
||||||
driver: local # Use the default local driver
|
driver: local # Use the default local driver
|
||||||
postgres_data_auth:
|
postgres_data_auth:
|
||||||
driver: local # Use the default local driver
|
driver: local # Use the default local driver
|
||||||
|
postgres_data_logledger:
|
||||||
|
driver: local
|
||||||
object_data:
|
object_data:
|
||||||
driver: local # Use the default local driver
|
driver: local # Use the default local driver
|
||||||
shared_credentials: # New shared volume
|
shared_credentials: # New shared volume
|
||||||
driver: local
|
driver: local
|
||||||
|
logledger_data: # New shared volume
|
||||||
|
driver: local
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
soaricarus-network:
|
soaricarus-network:
|
||||||
|
|||||||
+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