Compare commits

..
85 Commits
Author SHA1 Message Date
phoenix 9c35c66d61 ci: Getting closer
pr CI / Test Suite (pull_request) Successful in 2m22s
2026-08-08 13:58:00 -04:00
phoenix 76eae50e35 ci: Making env var available
pr CI / Test Suite (pull_request) Successful in 1m48s
2026-08-08 13:53:05 -04:00
phoenix 3cd4b81dc4 ci: Got something after this
pr CI / Test Suite (pull_request) Successful in 2m12s
2026-08-08 13:49:48 -04:00
phoenix 24128e91af ci: Try again
pr CI / Test Suite (pull_request) Successful in 1m50s
2026-08-08 13:46:28 -04:00
phoenix 3f982c1263 ci: Removing already created env
pr CI / Test Suite (pull_request) Successful in 4m22s
2026-08-08 13:40:55 -04:00
phoenix acdddfe49b ci: Wooo
pr CI / Test Suite (pull_request) Successful in 1m49s
2026-08-08 13:32:41 -04:00
phoenix 3d335db362 ci: Better
pr CI / Test Suite (pull_request) Failing after 1m33s
2026-08-08 13:29:05 -04:00
phoenix 602b7db6cd ci: Tweak
pr CI / Test Suite (pull_request) Failing after 1m39s
2026-08-08 13:25:18 -04:00
phoenix f00c16d1cd ci: Try it
pr CI / Test Suite (pull_request) Failing after 1m24s
2026-08-08 13:20:39 -04:00
phoenix 35c379a631 ci: Change
pr CI / Test Suite (pull_request) Failing after 1m36s
2026-08-08 13:12:08 -04:00
phoenix 076793a867 ci: Some tweaking
pr CI / Test Suite (pull_request) Failing after 2m9s
2026-08-08 13:07:47 -04:00
phoenix 565e0b2959 Try it
pr CI / Test Suite (pull_request) Successful in 1m41s
2026-08-08 13:01:19 -04:00
phoenix 16b92c0f5e ci: Go
pr CI / Test Suite (pull_request) Failing after 1m22s
2026-08-08 12:58:28 -04:00
phoenix e8e150e7b2 bump: soaricarus_api
pr CI / Test Suite (pull_request) Successful in 3m12s
2026-08-08 12:46:09 -04:00
phoenix 84e6ff4718 Updating readme 2026-08-08 12:45:54 -04:00
phoenix 043adeb390 ci: Updated 2026-08-08 12:45:39 -04:00
phoenix a2c9d938f9 ci: Changed url
pr CI / Test Suite (pull_request) Successful in 1m46s
2026-08-08 12:19:51 -04:00
phoenix 14f197d472 ci: Maybe this time?
pr CI / Test Suite (pull_request) Failing after 3m18s
2026-08-08 12:11:31 -04:00
phoenix efaa7122e2 ci: Getting somewhere
pr CI / Test Suite (pull_request) Canceled after 1m26s
2026-08-08 12:08:23 -04:00
phoenix 74dda6c9ef ci: Try it
pr CI / Test Suite (pull_request) Failing after 1m27s
2026-08-08 12:05:25 -04:00
phoenix 4c4326bb88 ci: Try it
pr CI / Test Suite (pull_request) Failing after 1m56s
2026-08-08 11:58:25 -04:00
phoenix fc01503b12 ci: Try it again
pr CI / Test Suite (pull_request) Failing after 2m21s
2026-08-07 12:42:13 -04:00
phoenix 2b70eeb1a9 ci: Checking it
pr CI / Test Suite (pull_request) Failing after 1m59s
2026-08-07 12:34:06 -04:00
phoenix 3106242640 ci: Try
pr CI / Test Suite (pull_request) Failing after 1m57s
2026-08-07 12:32:47 -04:00
phoenix 43d2625e69 ci: Go for it
pr CI / Test Suite (pull_request) Failing after 1m42s
2026-08-07 12:28:29 -04:00
phoenix 5ce07d8eb2 ci: Using docker
pr CI / Test Suite (pull_request) Failing after 1m24s
2026-08-07 12:25:09 -04:00
phoenix 9c57caa860 ci: Get it up
pr CI / Test Suite (pull_request) Failing after 1m23s
2026-08-07 11:48:31 -04:00
phoenix 2fd93cae64 Fix typo
pr CI / Test Suite (pull_request) Failing after 3m29s
2026-08-07 11:40:00 -04:00
phoenix 41d6ed0334 ci: Switching s3
pr CI / Test Suite (pull_request) Canceled after 2m44s
2026-08-07 11:39:13 -04:00
phoenix 6c0b0fa7f0 ci: Fix
pr CI / Test Suite (pull_request) Failing after 4m24s
2026-08-07 11:30:17 -04:00
phoenix dfa1dc4487 ci: This is a doozy 2026-08-07 11:29:04 -04:00
phoenix b3fb8b3088 Trying it out
pr CI / Test Suite (pull_request) Failing after 2m51s
2026-08-07 11:24:46 -04:00
phoenix 9368e80abe ci: Maybe this time
pr CI / Test Suite (pull_request) Canceled after 5m40s
2026-08-07 11:19:12 -04:00
phoenix 21928f7eac ci: Do it
pr CI / Test Suite (pull_request) Canceled after 6m14s
2026-08-07 11:13:02 -04:00
phoenix c28f1dd0a9 ci: Updating fake s3 port
pr CI / Test Suite (pull_request) Canceled after 3m0s
2026-08-07 11:10:06 -04:00
phoenix 84bd59f488 ci: Trying out fake s3
pr CI / Test Suite (pull_request) Canceled after 3m59s
2026-08-07 11:06:09 -04:00
phoenix f3f9d10ed5 ci: Focusing on test for now
pr CI / Test Suite (pull_request) Failing after 1m16s
2026-08-07 11:00:19 -04:00
phoenix a47694164c Fixing workflow
pr CI / Check (pull_request) Successful in 1m55s
pr CI / Test Suite (pull_request) Canceled after 8m14s
2026-08-07 10:52:15 -04:00
phoenix 25c745e951 Updating workflow
pr CI / Check (pull_request) Canceled after 1m52s
pr CI / Test Suite (pull_request) Canceled after 1m54s
2026-08-07 10:50:20 -04:00
phoenix 61df07732d Try it again
soaricarus_api CI / Rustfmt (pull_request) Successful in 2m11s
soaricarus_api CI / Test Suite (pull_request) Failing after 2m30s
soaricarus_api CI / Clippy (pull_request) Successful in 1m33s
soaricarus_api CI / build (pull_request) Successful in 1m51s
soaricarus_api CI / Check (pull_request) Successful in 5m14s
2026-08-06 18:56:19 -04:00
phoenix 685f2f9257 Let's try this
soaricarus_api CI / Check (pull_request) Successful in 2m26s
soaricarus_api CI / Rustfmt (pull_request) Successful in 2m38s
soaricarus_api CI / Test Suite (pull_request) Failing after 5m13s
soaricarus_api CI / Clippy (pull_request) Successful in 3m33s
soaricarus_api CI / build (pull_request) Successful in 3m28s
2026-08-06 18:49:48 -04:00
phoenix 9042ba13e7 ci: Change sleep time in s3 setup
soaricarus_api CI / Check (pull_request) Successful in 2m22s
soaricarus_api CI / Rustfmt (pull_request) Successful in 2m35s
soaricarus_api CI / Test Suite (pull_request) Failing after 2m36s
soaricarus_api CI / Clippy (pull_request) Successful in 2m16s
soaricarus_api CI / build (pull_request) Successful in 2m40s
2026-08-06 18:01:02 -04:00
phoenix 27e6b51616 bump: labyrinth
soaricarus_api CI / Check (pull_request) Successful in 2m3s
soaricarus_api CI / Test Suite (pull_request) Failing after 2m28s
soaricarus_api CI / Rustfmt (pull_request) Successful in 3m28s
soaricarus_api CI / Clippy (pull_request) Successful in 1m43s
soaricarus_api CI / build (pull_request) Successful in 3m41s
2026-08-06 17:56:05 -04:00
phoenix 4eee8e3b03 Updating workflow
soaricarus_api CI / Clippy (pull_request) Canceled after 0s
soaricarus_api CI / build (pull_request) Canceled after 0s
soaricarus_api CI / Check (pull_request) Canceled after 3m32s
soaricarus_api CI / Test Suite (pull_request) Canceled after 3m30s
soaricarus_api CI / Rustfmt (pull_request) Canceled after 3m29s
2026-08-06 17:55:17 -04:00
phoenix a05dae25d7 Let's see if the test passes
soaricarus_api CI / Rustfmt (pull_request) Successful in 2m27s
soaricarus_api CI / Test Suite (pull_request) Failing after 3m59s
soaricarus_api CI / Check (pull_request) Successful in 4m24s
soaricarus_api CI / Clippy (pull_request) Successful in 2m10s
soaricarus_api CI / build (pull_request) Successful in 3m15s
2026-08-06 17:39:46 -04:00
phoenix 78d74cf6f3 Updated sample env files
soaricarus_api CI / Check (pull_request) Successful in 6m15s
soaricarus_api CI / Rustfmt (pull_request) Successful in 2m58s
soaricarus_api CI / Clippy (pull_request) Successful in 3m29s
soaricarus_api CI / build (pull_request) Successful in 5m33s
soaricarus_api CI / Test Suite (pull_request) Successful in 5m27s
2026-08-06 17:17:59 -04:00
phoenix f7a1918462 ci: Updated docker compose 2026-08-06 17:17:45 -04:00
phoenix 9b6e6716c4 Updated code 2026-08-06 17:17:26 -04:00
phoenix 569c684c1c Added labyrinth 2026-08-06 11:45:34 -04:00
phoenix 6c910ab212 ci: Updated workflow
soaricarus_api CI / Rustfmt (pull_request) Successful in 2m25s
soaricarus_api CI / Check (pull_request) Successful in 2m30s
soaricarus_api CI / Clippy (pull_request) Successful in 1m35s
soaricarus_api CI / build (pull_request) Successful in 2m42s
soaricarus_api CI / Test Suite (pull_request) Successful in 7m52s
2026-08-06 11:37:00 -04:00
phoenix 6490f51d17 ci: Maybe this time
soaricarus_api CI / Check (pull_request) Successful in 1m41s
soaricarus_api CI / Rustfmt (pull_request) Successful in 1m46s
soaricarus_api CI / Test Suite (pull_request) Successful in 3m3s
soaricarus_api CI / Clippy (pull_request) Successful in 2m0s
soaricarus_api CI / build (pull_request) Successful in 2m41s
2026-08-06 11:29:17 -04:00
phoenix d50959c602 ci: Maybe this
soaricarus_api CI / Check (pull_request) Failing after 14m43s
soaricarus_api CI / Rustfmt (pull_request) Failing after 9m0s
soaricarus_api CI / Clippy (pull_request) Successful in 1m55s
soaricarus_api CI / build (pull_request) Successful in 2m3s
soaricarus_api CI / Test Suite (pull_request) Failing after 4m44s
2026-08-06 10:51:39 -04:00
phoenix edf109e4d9 ci: Maybe this time
soaricarus_api CI / Rustfmt (pull_request) Successful in 2m32s
soaricarus_api CI / Check (pull_request) Successful in 2m45s
soaricarus_api CI / Test Suite (pull_request) Failing after 3m23s
soaricarus_api CI / build (pull_request) Successful in 1m58s
soaricarus_api CI / Clippy (pull_request) Successful in 6m34s
2026-08-05 18:24:12 -04:00
phoenix d214ed106a Updating dockerfile 2026-08-05 18:07:15 -04:00
phoenix 77ec72dff4 ci: Added timeout
soaricarus_api CI / Check (pull_request) Successful in 3m11s
soaricarus_api CI / Test Suite (pull_request) Failing after 3m20s
soaricarus_api CI / Rustfmt (pull_request) Successful in 2m14s
soaricarus_api CI / Clippy (pull_request) Successful in 2m24s
soaricarus_api CI / build (pull_request) Successful in 2m9s
2026-08-05 18:03:46 -04:00
phoenix 40c41c1c1b ci: Updated yml
soaricarus_api CI / Test Suite (pull_request) Failing after 2m31s
soaricarus_api CI / Check (pull_request) Successful in 2m42s
soaricarus_api CI / Rustfmt (pull_request) Successful in 3m2s
soaricarus_api CI / Clippy (pull_request) Canceled after 1m9s
soaricarus_api CI / build (pull_request) Canceled after 3m55s
2026-08-05 18:00:08 -04:00
phoenix a34bc7c0ae Removing init script
soaricarus_api CI / Check (pull_request) Successful in 2m36s
soaricarus_api CI / Rustfmt (pull_request) Successful in 2m40s
soaricarus_api CI / Test Suite (pull_request) Failing after 3m24s
soaricarus_api CI / build (pull_request) Successful in 2m5s
soaricarus_api CI / Clippy (pull_request) Canceled after 2m37s
2026-08-05 17:53:56 -04:00
phoenix b436a1cd0a ci: Adding container name
soaricarus_api CI / Rustfmt (pull_request) Successful in 2m27s
soaricarus_api CI / Check (pull_request) Successful in 2m43s
soaricarus_api CI / Test Suite (pull_request) Failing after 3m31s
soaricarus_api CI / Clippy (pull_request) Successful in 1m25s
soaricarus_api CI / build (pull_request) Successful in 1m52s
2026-08-05 17:49:50 -04:00
phoenix 3648c65aa2 Removing unused garage files 2026-08-05 17:49:38 -04:00
phoenix ac1575f2d1 Tweak it
soaricarus_api CI / Check (pull_request) Successful in 2m26s
soaricarus_api CI / Rustfmt (pull_request) Successful in 2m21s
soaricarus_api CI / Clippy (pull_request) Successful in 1m43s
soaricarus_api CI / build (pull_request) Successful in 4m42s
soaricarus_api CI / Test Suite (pull_request) Failing after 1m12s
2026-08-05 17:38:06 -04:00
phoenix e86420f19c ci: Updated yml
soaricarus_api CI / Test Suite (pull_request) Failing after 5s
soaricarus_api CI / build (pull_request) Canceled after 0s
soaricarus_api CI / Check (pull_request) Canceled after 1m53s
soaricarus_api CI / Clippy (pull_request) Canceled after 1m48s
soaricarus_api CI / Rustfmt (pull_request) Canceled after 1m57s
2026-08-05 17:36:21 -04:00
phoenix efbeaf2f7e ci: Updated workflow
soaricarus_api CI / Test Suite (pull_request) Failing after 20s
soaricarus_api CI / Rustfmt (pull_request) Successful in 2m18s
soaricarus_api CI / Clippy (pull_request) Successful in 3m0s
soaricarus_api CI / build (pull_request) Successful in 1m27s
soaricarus_api CI / Check (pull_request) Successful in 4m45s
2026-08-04 18:19:44 -04:00
phoenix db07f2c39d Updated yml 2026-08-04 18:19:27 -04:00
phoenix bae1dd4173 Updating docker file
soaricarus_api CI / Rustfmt (pull_request) Successful in 2m24s
soaricarus_api CI / Check (pull_request) Successful in 3m15s
soaricarus_api CI / Clippy (pull_request) Successful in 1m34s
soaricarus_api CI / build (pull_request) Successful in 1m27s
soaricarus_api CI / Test Suite (pull_request) Successful in 8m55s
2026-08-04 17:54:39 -04:00
phoenix b02cabc016 Updating sample env files 2026-08-04 17:54:28 -04:00
phoenix f5be2a44b9 Got it working
soaricarus_api CI / Rustfmt (pull_request) Successful in 3m54s
soaricarus_api CI / Check (pull_request) Successful in 4m31s
soaricarus_api CI / Test Suite (pull_request) Successful in 4m51s
soaricarus_api CI / Clippy (pull_request) Successful in 2m34s
soaricarus_api CI / build (pull_request) Successful in 3m32s
2026-08-04 17:36:22 -04:00
phoenix 82515b4ad7 Updating garage.toml 2026-08-04 17:03:39 -04:00
phoenix 45534a9d18 Updated sample env 2026-08-04 17:02:35 -04:00
phoenix 6392169878 Saving changes. Just going to stick with one docker service for storage
soaricarus_api CI / Rustfmt (pull_request) Successful in 5m54s
soaricarus_api CI / Check (pull_request) Successful in 6m4s
soaricarus_api CI / Test Suite (pull_request) Successful in 7m40s
soaricarus_api CI / build (pull_request) Successful in 3m18s
soaricarus_api CI / Clippy (pull_request) Successful in 4m41s
2026-08-04 12:34:39 -04:00
phoenix b583ff8ef1 Saving files 2026-08-04 11:08:30 -04:00
phoenix 140b9dba45 Saving script change
soaricarus_api CI / Rustfmt (pull_request) Successful in 2m57s
soaricarus_api CI / Test Suite (pull_request) Successful in 3m34s
soaricarus_api CI / Check (pull_request) Successful in 3m54s
soaricarus_api CI / Clippy (pull_request) Successful in 2m31s
soaricarus_api CI / build (pull_request) Successful in 2m59s
2026-07-30 16:59:58 -04:00
phoenix 10cec1d7c7 Getting closer
soaricarus_api CI / Rustfmt (pull_request) Failing after 14m32s
soaricarus_api CI / Test Suite (pull_request) Failing after 14m33s
soaricarus_api CI / Check (pull_request) Failing after 14m34s
soaricarus_api CI / Clippy (pull_request) Successful in 3m11s
soaricarus_api CI / build (pull_request) Successful in 3m46s
2026-07-30 13:23:17 -04:00
phoenix f07e0108cd Getting closer
soaricarus_api CI / Check (pull_request) Successful in 6m2s
soaricarus_api CI / Rustfmt (pull_request) Successful in 6m11s
soaricarus_api CI / Test Suite (pull_request) Successful in 8m25s
soaricarus_api CI / Clippy (pull_request) Successful in 3m12s
soaricarus_api CI / build (pull_request) Successful in 4m34s
2026-07-28 13:08:33 -04:00
phoenix e2a5e02aad Trying
soaricarus_api CI / Rustfmt (pull_request) Successful in 2m21s
soaricarus_api CI / Test Suite (pull_request) Successful in 3m55s
soaricarus_api CI / Check (pull_request) Successful in 4m15s
soaricarus_api CI / Clippy (pull_request) Successful in 4m22s
soaricarus_api CI / build (pull_request) Successful in 3m48s
2026-07-24 19:12:19 -04:00
phoenix 6574d0ee8f I am tired boss
soaricarus_api CI / Rustfmt (pull_request) Successful in 2m26s
soaricarus_api CI / Check (pull_request) Successful in 3m24s
soaricarus_api CI / Clippy (pull_request) Successful in 3m43s
soaricarus_api CI / Test Suite (pull_request) Successful in 6m32s
soaricarus_api CI / build (pull_request) Successful in 3m25s
2026-07-24 15:33:18 -04:00
phoenix 75f4d9fa76 Saving changes. No real progress yet
soaricarus_api CI / Test Suite (pull_request) Successful in 3m36s
soaricarus_api CI / Check (pull_request) Successful in 4m3s
soaricarus_api CI / Rustfmt (pull_request) Successful in 5m49s
soaricarus_api CI / Clippy (pull_request) Successful in 2m24s
soaricarus_api CI / build (pull_request) Successful in 4m32s
2026-07-24 12:23:48 -04:00
phoenix 3de818f280 Saving changes
soaricarus_api CI / Rustfmt (pull_request) Successful in 3m50s
soaricarus_api CI / Check (pull_request) Successful in 5m0s
soaricarus_api CI / Test Suite (pull_request) Successful in 6m7s
soaricarus_api CI / Clippy (pull_request) Successful in 3m28s
soaricarus_api CI / build (pull_request) Successful in 3m42s
2026-07-23 17:19:29 -04:00
phoenix f116adffdb Saving changes. Nothing yet 2026-07-23 16:26:14 -04:00
phoenix 3965d86d54 Saving script 2026-07-23 16:21:40 -04:00
phoenix 8fae71b086 Getting somewhere. Object Storage is initialized but not initializing hangs 2026-07-23 16:05:21 -04:00
phoenix 2bfb8c6aee Got garage to run in docker
soaricarus_api CI / Rustfmt (pull_request) Successful in 2m13s
soaricarus_api CI / Check (pull_request) Successful in 4m13s
soaricarus_api CI / Test Suite (pull_request) Successful in 5m55s
soaricarus_api CI / Clippy (pull_request) Successful in 4m30s
soaricarus_api CI / build (pull_request) Successful in 4m57s
2026-07-23 15:31:41 -04:00
phoenix 327d04e8a9 Revert "Removing garage.toml"
soaricarus_api CI / Clippy (pull_request) Canceled after 0s
soaricarus_api CI / build (pull_request) Canceled after 0s
soaricarus_api CI / Check (pull_request) Canceled after 2m22s
soaricarus_api CI / Rustfmt (pull_request) Canceled after 2m10s
soaricarus_api CI / Test Suite (pull_request) Canceled after 4m15s
This reverts commit 7a209eeb5e.
2026-07-23 15:28:58 -04:00
phoenix 7a209eeb5e Removing garage.toml 2026-07-23 15:15:11 -04:00
phoenix 7460f0d157 Updating some of the sample env
soaricarus_api CI / Rustfmt (pull_request) Successful in 3m17s
soaricarus_api CI / Check (pull_request) Successful in 4m30s
soaricarus_api CI / Test Suite (pull_request) Successful in 4m38s
soaricarus_api CI / Clippy (pull_request) Successful in 3m58s
soaricarus_api CI / build (pull_request) Successful in 3m8s
2026-07-22 17:20:58 -04:00
phoenix 4b7816e117 Adding image to store data 2026-07-22 17:20:37 -04:00
21 changed files with 1029 additions and 1623 deletions
+13 -16
View File
@@ -50,7 +50,6 @@ jobs:
AWS_ACCESS_KEY_ID: "${{ secrets.GARAGE_KEY_ID }}" AWS_ACCESS_KEY_ID: "${{ secrets.GARAGE_KEY_ID }}"
AWS_SECRET_ACCESS_KEY: "${{ secrets.GARAGE_SECRET }}" AWS_SECRET_ACCESS_KEY: "${{ secrets.GARAGE_SECRET }}"
AWS_DEFAULT_REGION: us-east-1 AWS_DEFAULT_REGION: us-east-1
ENDPOINT_URL: "${{ secrets.S3_CI_ENDPOINT_URL}}"
run: | run: |
sudo apt update sudo apt update
echo "Installing curl and unzip" echo "Installing curl and unzip"
@@ -65,14 +64,12 @@ jobs:
BUCKET="soaricarus-ci-bucket-$(echo $RANDOM | md5sum | head -c 8)" BUCKET="soaricarus-ci-bucket-$(echo $RANDOM | md5sum | head -c 8)"
echo "S3_BUCKET=$BUCKET" >> $GITHUB_ENV echo "S3_BUCKET=$BUCKET" >> $GITHUB_ENV
echo "AWS_DEFAULT_REGION=$AWS_DEFAULT_REGION" >> $GITHUB_ENV echo "AWS_DEFAULT_REGION=$AWS_DEFAULT_REGION" >> $GITHUB_ENV
echo "AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID" >> $GITHUB_ENV
echo "AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY" >> $GITHUB_ENV
echo "Creating bucket: $BUCKET" echo "Creating bucket: $BUCKET"
aws --endpoint-url=$ENDPOINT_URL s3 mb s3://$BUCKET --region $AWS_DEFAULT_REGION aws --endpoint-url=${{ secrets.S3_CI_ENDPOINT_URL }} s3 mb s3://$BUCKET --region $AWS_DEFAULT_REGION
- name: Run tests - name: Run tests
env: env:
# Define DATABASE_URL for tests to use
DATABASE_URL: postgresql://${{ secrets.DB_TEST_USER || 'testuser' }}:${{ secrets.DB_TEST_PASSWORD || 'testpassword' }}@postgres:5432/${{ secrets.DB_TEST_NAME || 'testdb' }} DATABASE_URL: postgresql://${{ secrets.DB_TEST_USER || 'testuser' }}:${{ secrets.DB_TEST_PASSWORD || 'testpassword' }}@postgres:5432/${{ secrets.DB_TEST_NAME || 'testdb' }}
RUST_LOG: info # Optional: configure test log level RUST_LOG: info # Optional: configure test log level
SECRET_MAIN_KEY: ${{ secrets.TOKEN_SECRET_KEY }} SECRET_MAIN_KEY: ${{ secrets.TOKEN_SECRET_KEY }}
@@ -80,10 +77,10 @@ jobs:
ROOT_DIRECTORY: "/tmp" ROOT_DIRECTORY: "/tmp"
AWS_ACCESS_KEY_ID: "${{ secrets.GARAGE_KEY_ID }}" AWS_ACCESS_KEY_ID: "${{ secrets.GARAGE_KEY_ID }}"
AWS_SECRET_ACCESS_KEY: "${{ secrets.GARAGE_SECRET }}" AWS_SECRET_ACCESS_KEY: "${{ secrets.GARAGE_SECRET }}"
AWS_DEFAULT_REGION: "${{ env.AWS_DEFAULT_REGION }}" AWS_DEFAULT_REGION: us-east-1
GARAGE_DEFAULT_ACCESS_KEY: "${{ secrets.GARAGE_KEY_ID }}" GARAGE_DEFAULT_ACCESS_KEY: "${{ secrets.GARAGE_KEY_ID }}"
GARAGE_DEFAULT_SECRET_KEY: "${{ secrets.GARAGE_SECRET }}" GARAGE_DEFAULT_SECRET_KEY: "${{ secrets.GARAGE_SECRET }}"
GARAGE_S3_REGION: "${{ env.AWS_DEFAULT_REGION }}" GARAGE_S3_REGION: us-east-1
S3_BUCKET_NAME: ${{ env.S3_BUCKET }} S3_BUCKET_NAME: ${{ env.S3_BUCKET }}
S3_ENDPOINT_URL: "${{ secrets.S3_CI_ENDPOINT_URL }}" S3_ENDPOINT_URL: "${{ secrets.S3_CI_ENDPOINT_URL }}"
AWS_S3_FORCE_PATH_STYLE: "true" AWS_S3_FORCE_PATH_STYLE: "true"
@@ -96,21 +93,21 @@ jobs:
eval $(ssh-agent -s) eval $(ssh-agent -s)
ssh-add -v ~/.ssh/soaricarus_models_deploy_key ssh-add -v ~/.ssh/soaricarus_models_deploy_key
echo "Bucket: $S3_BUCKET"
echo "S3 Bucket: $S3_BUCKET_NAME"
cargo test cargo test
- name: Cleanup - name: Cleanup
if: always() if: always()
run: | run: |
echo "Cleaning up bucket $BUCK" echo "Cleaning up bucket ${{ env.S3_BUCKET }}"
echo "Region: $AWS_DEFAULT_REGION" echo "Region: ${{ env.AWS_DEFAULT_REGION }}"
echo "B: $BUCK"
aws --endpoint-url=$ENDPOINT_URL \ aws --endpoint-url=${{ secrets.S3_CI_ENDPOINT_URL }} \
s3 rb s3://$BUCK --force \ s3 rb s3://${{ env.S3_BUCKET }} --force \
--region $AWS_DEFAULT_REGION --region $AWS_DEFAULT_REGION
env: env:
ENDPOINT_URL: ${{ secrets.S3_CI_ENDPOINT_URL }} AWS_DEFAULT_REGION: us-east-1
AWS_ACCESS_KEY_ID: "${{ env.AWS_ACCESS_KEY_ID }}"
AWS_SECRET_ACCESS_KEY: "${{ env.AWS_SECRET_ACCESS_KEY }}"
AWS_DEFAULT_REGION: "${{ env.AWS_DEFAULT_REGION }}"
BUCK: ${{ env.S3_BUCKET }} BUCK: ${{ env.S3_BUCKET }}
continue-on-error: true continue-on-error: true
+21 -31
View File
@@ -67,45 +67,40 @@ jobs:
- name: Setup S3 - name: Setup S3
env: env:
GARAGE_DEFAULT_ACCESS_KEY: "${{ secrets.GARAGE_KEY_ID }}"
GARAGE_DEFAULT_SECRET_KEY: "${{ secrets.GARAGE_SECRET }}"
GARAGE_DEFAULT_BUCKET: "soaricarus-ci-bucket"
AWS_ACCESS_KEY_ID: "${{ secrets.GARAGE_KEY_ID }}" AWS_ACCESS_KEY_ID: "${{ secrets.GARAGE_KEY_ID }}"
AWS_SECRET_ACCESS_KEY: "${{ secrets.GARAGE_SECRET }}" AWS_SECRET_ACCESS_KEY: "${{ secrets.GARAGE_SECRET }}"
AWS_DEFAULT_REGION: us-east-1 AWS_DEFAULT_REGION: us-east-1
ENDPOINT_URL: "${{ secrets.S3_CI_ENDPOINT_URL}}"
run: | run: |
sudo apt update sudo apt update
echo "Installing curl and unzip"
sudo apt install curl unzip -y sudo apt install curl unzip -y
echo "Installing awscli"
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip unzip awscliv2.zip
sudo ./aws/install sudo ./aws/install
aws --version aws --version
# curl -v ${{ secrets.S3_CI_ENDPOINT_URL }}
BUCKET="soaricarus-ci-bucket-$(echo $RANDOM | md5sum | head -c 8)" # Create bucket
echo "S3_BUCKET=$BUCKET" >> $GITHUB_ENV aws --endpoint-url=${{ secrets.S3_CI_ENDPOINT_URL }} s3 mb s3://soaricarus-ci-bucket --region us-east-1
echo "AWS_DEFAULT_REGION=$AWS_DEFAULT_REGION" >> $GITHUB_ENV
echo "AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID" >> $GITHUB_ENV
echo "AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY" >> $GITHUB_ENV
echo "Creating bucket: $BUCKET"
aws --endpoint-url=$ENDPOINT_URL s3 mb s3://$BUCKET --region $AWS_DEFAULT_REGION
- name: Run tests - name: Run tests
env: env:
# Define DATABASE_URL for tests to use
DATABASE_URL: postgresql://${{ secrets.DB_TEST_USER || 'testuser' }}:${{ secrets.DB_TEST_PASSWORD || 'testpassword' }}@postgres:5432/${{ secrets.DB_TEST_NAME || 'testdb' }} DATABASE_URL: postgresql://${{ secrets.DB_TEST_USER || 'testuser' }}:${{ secrets.DB_TEST_PASSWORD || 'testpassword' }}@postgres:5432/${{ secrets.DB_TEST_NAME || 'testdb' }}
RUST_LOG: info # Optional: configure test log level RUST_LOG: info # Optional: configure test log level
SECRET_MAIN_KEY: ${{ secrets.TOKEN_SECRET_KEY }} SECRET_MAIN_KEY: ${{ secrets.TOKEN_SECRET_KEY }}
SSH_AUTH_SOCK: ${{ env.SSH_AUTH_SOCK }} SSH_AUTH_SOCK: ${{ env.SSH_AUTH_SOCK }}
ROOT_DIRECTORY: "/tmp" ROOT_DIRECTORY: "/tmp"
AWS_ACCESS_KEY_ID: "${{ secrets.GARAGE_KEY_ID }}" AWS_ACCESS_KEY_ID: ${{ secrets.GARAGE_KEY_ID }}
AWS_SECRET_ACCESS_KEY: "${{ secrets.GARAGE_SECRET }}" AWS_SECRET_ACCESS_KEY: ${{ secrets.GARAGE_SECRET }}
AWS_DEFAULT_REGION: "${{ env.AWS_DEFAULT_REGION }}" AWS_DEFAULT_REGION: us-east-1
GARAGE_DEFAULT_ACCESS_KEY: "${{ secrets.GARAGE_KEY_ID }}" GARAGE_DEFAULT_ACCESS_KEY: ${{ secrets.GARAGE_KEY_ID }}
GARAGE_DEFAULT_SECRET_KEY: "${{ secrets.GARAGE_SECRET }}" GARAGE_DEFAULT_SECRET_KEY: ${{ secrets.GARAGE_SECRET }}
GARAGE_S3_REGION: "${{ env.AWS_DEFAULT_REGION }}" GARAGE_S3_REGION: us-east-1
S3_BUCKET_NAME: ${{ env.S3_BUCKET }} S3_BUCKET_NAME: "soaricarus-ci-bucket"
S3_ENDPOINT_URL: "${{ secrets.S3_CI_ENDPOINT_URL }}" S3_ENDPOINT_URL: "http://localhost:3900"
AWS_S3_FORCE_PATH_STYLE: "true" AWS_S3_FORCE_PATH_STYLE: "true"
run: | run: |
mkdir -p ~/.ssh mkdir -p ~/.ssh
@@ -121,18 +116,13 @@ jobs:
- name: Cleanup - name: Cleanup
if: always() if: always()
run: | run: |
echo "Cleaning up bucket $BUCK" aws --endpoint-url=${{ secrets.S3_CI_ENDPOINT_URL }} \
echo "Region: $AWS_DEFAULT_REGION" s3 rb s3://soaricarus-ci-bucket --force \
--region us-east-1
aws --endpoint-url=$ENDPOINT_URL \
s3 rb s3://$BUCK --force \
--region $AWS_DEFAULT_REGION
env: env:
ENDPOINT_URL: ${{ secrets.S3_CI_ENDPOINT_URL }} AWS_ACCESS_KEY_ID: "${{ secrets.GARAGE_KEY_ID }}"
AWS_ACCESS_KEY_ID: "${{ env.AWS_ACCESS_KEY_ID }}" AWS_SECRET_ACCESS_KEY: "${{ secrets.GARAGE_SECRET }}"
AWS_SECRET_ACCESS_KEY: "${{ env.AWS_SECRET_ACCESS_KEY }}" AWS_DEFAULT_REGION: us-east-1
AWS_DEFAULT_REGION: "${{ env.AWS_DEFAULT_REGION }}"
BUCK: ${{ env.S3_BUCKET }}
continue-on-error: true continue-on-error: true
fmt: fmt:
Generated
+236 -249
View File
File diff suppressed because it is too large Load Diff
+12 -12
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "soaricarus_api" name = "soaricarus_api"
version = "0.5.7" version = "0.5.3"
edition = "2024" edition = "2024"
rust-version = "1.95" rust-version = "1.95"
license = "MIT" license = "MIT"
@@ -10,26 +10,26 @@ description = "Core API for interacting with soaricarus"
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.81", features = ["vendored"] }
serde = { version = "1.0.229", features = ["derive"] } serde = { version = "1.0.228", features = ["derive"] }
serde_json = { version = "1.0.151" } serde_json = { version = "1.0.150" }
tokio = { version = "1.53.1", features = ["full"] } tokio = { version = "1.52.3", features = ["full"] }
tokio-util = { version = "0.7.19", features = ["io"] } tokio-util = { version = "0.7.18", features = ["io"] }
tower = { version = "0.5.3", features = ["full"] } tower = { version = "0.5.3", features = ["full"] }
tower-http = { version = "0.7.0", features = ["cors", "timeout"] } tower-http = { version = "0.7.0", features = ["cors", "timeout"] }
tracing-subscriber = "0.3.23" tracing-subscriber = "0.3.23"
futures = { version = "0.3.34" } futures = { version = "0.3.32" }
mime_guess = { version = "2.0.5" } mime_guess = { version = "2.0.5" }
uuid = { version = "1.24.1", features = ["v4", "serde"] } uuid = { version = "1.23.5", features = ["v4", "serde"] }
sqlx = { version = "0.9.0", features = ["postgres", "runtime-tokio", "tls-native-tls", "time", "uuid"] } sqlx = { version = "0.9.0", features = ["postgres", "runtime-tokio", "tls-native-tls", "time", "uuid"] }
time = { version = "0.3.55", features = ["formatting", "macros", "parsing", "serde"] } time = { version = "0.3.53", features = ["formatting", "macros", "parsing", "serde"] }
jsonwebtoken = { version = "10.3.0", features = ["rust_crypto"] } jsonwebtoken = { version = "10.3.0", features = ["rust_crypto"] }
josekit = { version = "0.10.3" } josekit = { version = "0.10.3" }
utoipa = { version = "5.5.0", features = ["axum_extras"] } utoipa = { version = "5.5.0", features = ["axum_extras"] }
utoipa-swagger-ui = { version = "9.0.2", features = ["axum"] } utoipa-swagger-ui = { version = "9.0.2", features = ["axum"] }
simeta = { git = "ssh://git@git.kundeng.us/phoenix/simeta.git", tag = "v0.6.2" } simeta = { git = "ssh://git@git.kundeng.us/phoenix/simeta.git", tag = "v0.6.1-main-b690995806-680" }
simodels = { git = "ssh://git@git.kundeng.us/phoenix/simodels.git", tag = "v0.11.5-main-94d97cb81d-111" } simodels = { git = "ssh://git@git.kundeng.us/phoenix/simodels.git", tag = "v0.11.3-main-fe9d101bd0-111" }
sienvy = { git = "ssh://git@git.kundeng.us/phoenix/sienvy.git", tag = "v0.8.1" } sienvy = { git = "ssh://git@git.kundeng.us/phoenix/sienvy.git", tag = "v0.8.0-main-d06c8fdf49-006" }
labyrinth = { git = "ssh://git@git.kundeng.us/phoenix/labyrinth.git", tag = "v0.0.5" } labyrinth = { git = "ssh://git@git.kundeng.us/phoenix/labyrinth.git", tag = "v0.0.2-1-84f98521c8-928" }
[dev-dependencies] [dev-dependencies]
common-multipart-rfc7578 = { version = "0.7.0" } common-multipart-rfc7578 = { version = "0.7.0" }
+1 -1
View File
@@ -1,6 +1,6 @@
MIT License MIT License
Copyright (c) 2026 Kun Deng Copyright (c) 2025 Kun Deng
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
+2 -18
View File
@@ -6,17 +6,10 @@ CREATE TABLE IF NOT EXISTS "songQueue" (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(), id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
filename TEXT NOT NULL, filename TEXT NOT NULL,
status TEXT CHECK (status IN ('pending', 'ready', 'processing', 'done')), status TEXT CHECK (status IN ('pending', 'ready', 'processing', 'done')),
data BYTEA NULL,
user_id UUID NULL user_id UUID NULL
); );
CREATE TABLE IF NOT EXISTS "songQueueData" (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
file_key TEXT NOT NULL,
bucket TEXT NOT NULL,
region TEXT NOT NULL,
song_queue_id UUID NOT NULL
);
-- Table to store queued metadata -- Table to store queued metadata
CREATE TABLE IF NOT EXISTS "metadataQueue" ( CREATE TABLE IF NOT EXISTS "metadataQueue" (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(), id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
@@ -28,18 +21,11 @@ CREATE TABLE IF NOT EXISTS "metadataQueue" (
-- Table to store queued coverart -- Table to store queued coverart
CREATE TABLE IF NOT EXISTS "coverartQueue" ( CREATE TABLE IF NOT EXISTS "coverartQueue" (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(), id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
data BYTEA NULL,
file_type TEXT NOT NULL, file_type TEXT NOT NULL,
song_queue_id UUID NULL song_queue_id UUID NULL
); );
CREATE TABLE IF NOT EXISTS "coverartQueueData" (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
file_key TEXT NOT NULL,
bucket TEXT NOT NULL,
region TEXT NOT NULL,
coverart_queue_id UUID NOT NULL
);
-- Create an index for better query performance -- Create an index for better query performance
CREATE INDEX metadata_queue_data_metadata ON "metadataQueue" USING gin (metadata); CREATE INDEX metadata_queue_data_metadata ON "metadataQueue" USING gin (metadata);
@@ -63,7 +49,6 @@ CREATE TABLE IF NOT EXISTS "song" (
date_created timestamptz DEFAULT now(), date_created timestamptz DEFAULT now(),
filename TEXT NOT NULL, filename TEXT NOT NULL,
directory TEXT NOT NULL, directory TEXT NOT NULL,
file_key TEXT NOT NULL,
user_id UUID NULL user_id UUID NULL
-- TODO: Add coverart id later. This will allow multiple songs to be linked to a single cover art -- TODO: Add coverart id later. This will allow multiple songs to be linked to a single cover art
); );
@@ -74,6 +59,5 @@ CREATE TABLE IF NOT EXISTS "coverart" (
directory TEXT NOT NULL, directory TEXT NOT NULL,
filename TEXT NOT NULL, filename TEXT NOT NULL,
file_type TEXT NOT NULL, file_type TEXT NOT NULL,
file_key TEXT NOT NULL,
song_id UUID NOT NULL song_id UUID NOT NULL
); );
+22 -60
View File
@@ -63,16 +63,14 @@ pub mod endpoint {
let mut response = super::response::create_coverart::Response::default(); let mut response = super::response::create_coverart::Response::default();
let id = payload.coverart_queue_id; let id = payload.coverart_queue_id;
match repo_queue::data::queue::coverart::get_with_coverart_queue_id(&pool, &id).await { match repo_queue::coverart::get_coverart_queue_data_with_id(&pool, &id).await {
Ok((_id, file_key, _bucket, _region, _)) => { Ok(data) => {
let lab_config = crate::util::maze::get_config(); let song_id = payload.song_id;
let lr = labyrinth::Labyrinth { config: lab_config }; match crate::repo::song::get_song(&pool, &song_id).await {
Ok(song) => {
match lr.download(&file_key).await { let directory = sienvy::environment::get_root_directory().value;
Ok(data) => {
let file_type = let file_type =
simeta::detection::coverart::file_type_from_data(&data).unwrap(); simeta::detection::coverart::file_type_from_data(&data).unwrap();
let coverart_type = if file_type.file_type let coverart_type = if file_type.file_type
== simeta::detection::coverart::constants::JPEG_TYPE == simeta::detection::coverart::constants::JPEG_TYPE
{ {
@@ -95,45 +93,18 @@ pub mod endpoint {
let filename = let filename =
simodels::coverart::generate_filename(coverart_type, true).unwrap(); simodels::coverart::generate_filename(coverart_type, true).unwrap();
let data = labyrinth::Data { let mut coverart = simodels::coverart::init::init_coverart_dir_and_filename(
raw_data: data, &directory, &filename,
..Default::default() );
}; coverart.title = song.album.clone();
let new_file_key = format!("processed/coverart/{filename}"); coverart.file_type = file_type.file_type;
coverart.data = data;
match lr.upload(&new_file_key, &data).await { match coverart.save_to_filesystem() {
Ok(_resp) => { Ok(_) => {
// TODO: Change it to the s3 bucket match repo::coverart::create(&pool, &coverart, &song.id).await {
let directory = sienvy::environment::get_root_directory().value;
let mut coverart =
simodels::coverart::init::init_coverart_dir_and_filename(
&directory, &filename,
);
let song = match crate::repo::song::get_song(
&pool,
&payload.song_id,
)
.await
{
Ok(song) => song,
Err(err) => {
eprintln!("Error: {err:?}");
return (
axum::http::StatusCode::BAD_REQUEST,
axum::Json(response),
);
}
};
coverart.title = song.album.clone();
coverart.file_type = file_type.file_type;
coverart.data = data.raw_data;
coverart.file_key = new_file_key;
match repo::coverart::create(&pool, &coverart, &payload.song_id)
.await
{
Ok(id) => { Ok(id) => {
coverart.song_id = payload.song_id; coverart.song_id = song_id;
coverart.id = id; coverart.id = id;
println!("Cover Art created"); println!("Cover Art created");
@@ -149,7 +120,7 @@ pub mod endpoint {
} }
} }
Err(err) => { Err(err) => {
eprintln!("Error: {err:?}"); response.message = err.to_string();
( (
axum::http::StatusCode::INTERNAL_SERVER_ERROR, axum::http::StatusCode::INTERNAL_SERVER_ERROR,
axum::Json(response), axum::Json(response),
@@ -158,20 +129,14 @@ pub mod endpoint {
} }
} }
Err(err) => { Err(err) => {
eprintln!("Error: {err:?}"); response.message = err.to_string();
( (axum::http::StatusCode::BAD_REQUEST, axum::Json(response))
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
axum::Json(response),
)
} }
} }
} }
Err(err) => { Err(err) => {
eprintln!("Error: {err:?}"); response.message = err.to_string();
( (axum::http::StatusCode::BAD_REQUEST, axum::Json(response))
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
axum::Json(response),
)
} }
} }
} }
@@ -232,11 +197,8 @@ pub mod endpoint {
axum::Extension(pool): axum::Extension<sqlx::PgPool>, axum::Extension(pool): axum::Extension<sqlx::PgPool>,
axum::extract::Path(id): axum::extract::Path<uuid::Uuid>, axum::extract::Path(id): axum::extract::Path<uuid::Uuid>,
) -> (axum::http::StatusCode, axum::response::Response) { ) -> (axum::http::StatusCode, axum::response::Response) {
let lab_config = crate::util::maze::get_config();
let lr = labyrinth::Labyrinth { config: lab_config };
match repo::coverart::get_coverart(&pool, &id).await { match repo::coverart::get_coverart(&pool, &id).await {
Ok(coverart) => match lr.download(&coverart.file_key).await { Ok(coverart) => match simodels::coverart::io::to_data(&coverart) {
Ok(data) => { Ok(data) => {
let (file_type, img_type) = let (file_type, img_type) =
match simeta::detection::coverart::file_type_from_data(&data) { match simeta::detection::coverart::file_type_from_data(&data) {
+50 -145
View File
@@ -178,60 +178,14 @@ pub mod endpoint {
file_type file_type
); );
let lab_config = crate::util::maze::get_config(); match repo::coverart::insert(&pool, &raw_data, &file_type.file_type).await {
Ok(id) => {
let lr = labyrinth::Labyrinth { config: lab_config }; response.message = String::from("Successful");
let data = labyrinth::Data { response.data.push(id);
raw_data, (axum::http::StatusCode::OK, axum::Json(response))
..Default::default()
};
let filename = simodels::coverart::generate_filename(
simodels::types::CoverArtType::JpegExtension,
true,
)
.unwrap();
let file_path = format!("queued/coverart/{filename}");
println!("Key: {file_path:?}");
match lr.upload(&file_path, &data).await {
Ok(_res) => {
match repo::coverart::insert(&pool, &file_type.file_type).await {
Ok(id) => {
println!("Inserting queued data");
match repo::data::queue::coverart::insert(
&pool,
&file_path,
&lr.config.bucket,
&lr.config.region,
&id,
)
.await
{
Ok(_id) => {
println!("Successfully did it");
response.message = String::from("Successful");
response.data.push(id);
(axum::http::StatusCode::OK, axum::Json(response))
}
Err(err) => {
response.message = err.to_string();
(
axum::http::StatusCode::BAD_REQUEST,
axum::Json(response),
)
}
}
}
Err(err) => {
response.message = err.to_string();
(axum::http::StatusCode::BAD_REQUEST, axum::Json(response))
}
}
} }
Err(err) => { Err(err) => {
eprintln!("Error: {err:?}"); response.message = err.to_string();
(axum::http::StatusCode::BAD_REQUEST, axum::Json(response)) (axum::http::StatusCode::BAD_REQUEST, axum::Json(response))
} }
} }
@@ -359,73 +313,47 @@ pub mod endpoint {
)] )]
pub async fn fetch_coverart_with_data( pub async fn fetch_coverart_with_data(
axum::Extension(pool): axum::Extension<sqlx::PgPool>, axum::Extension(pool): axum::Extension<sqlx::PgPool>,
axum::extract::Path(coverart_queue_id): axum::extract::Path<uuid::Uuid>, axum::extract::Path(id): axum::extract::Path<uuid::Uuid>,
) -> (axum::http::StatusCode, axum::response::Response) { ) -> (axum::http::StatusCode, axum::response::Response) {
match repo::data::queue::coverart::get_with_coverart_queue_id(&pool, &coverart_queue_id) match repo::coverart::get_coverart_queue_data_with_id(&pool, &id).await {
.await Ok(data) => {
{ let file_type = simeta::detection::coverart::file_type_from_data(&data).unwrap();
Ok((_id, file_key, _bucket, _region, _)) => { let bytes = axum::body::Bytes::from(data);
let lab_config = crate::util::maze::get_config(); let mut response = bytes.into_response();
let lr = labyrinth::Labyrinth { config: lab_config }; let headers = response.headers_mut();
headers.insert(
axum::http::header::CONTENT_TYPE,
file_type.mime.parse().unwrap(),
);
match lr.download(&file_key).await { let coverart_type = if file_type.file_type
Ok(data) => { == simeta::detection::coverart::constants::JPEG_TYPE
let file_type = {
simeta::detection::coverart::file_type_from_data(&data).unwrap(); simodels::types::CoverArtType::JpegExtension
let bytes = axum::body::Bytes::from(data); } else if file_type.file_type == simeta::detection::coverart::constants::JPG_TYPE {
let mut response = bytes.into_response(); simodels::types::CoverArtType::JpgExtension
let headers = response.headers_mut(); } else if file_type.file_type == simeta::detection::coverart::constants::PNG_TYPE {
headers.insert( simodels::types::CoverArtType::PngExtension
axum::http::header::CONTENT_TYPE, } else {
file_type.mime.parse().unwrap(), return (
); axum::http::StatusCode::INTERNAL_SERVER_ERROR,
axum::response::Response::default(),
);
};
let filename = simodels::coverart::generate_filename(coverart_type, true).unwrap();
headers.insert(
axum::http::header::CONTENT_DISPOSITION,
format!("attachment; filename=\"{filename}\"")
.parse()
.unwrap(),
);
let coverart_type = if file_type.file_type (axum::http::StatusCode::OK, response)
== simeta::detection::coverart::constants::JPEG_TYPE
{
simodels::types::CoverArtType::JpegExtension
} else if file_type.file_type
== simeta::detection::coverart::constants::JPG_TYPE
{
simodels::types::CoverArtType::JpgExtension
} else if file_type.file_type
== simeta::detection::coverart::constants::PNG_TYPE
{
simodels::types::CoverArtType::PngExtension
} else {
return (
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
axum::response::Response::default(),
);
};
let filename =
simodels::coverart::generate_filename(coverart_type, true).unwrap();
headers.insert(
axum::http::header::CONTENT_DISPOSITION,
format!("attachment; filename=\"{filename}\"")
.parse()
.unwrap(),
);
(axum::http::StatusCode::OK, response)
}
Err(err) => {
eprintln!("Error: {err:?}");
(
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
axum::response::Response::default(),
)
}
}
}
Err(err) => {
eprintln!("Record not found");
eprintln!("Error: {err:?}");
(
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
axum::response::Response::default(),
)
} }
Err(_err) => (
axum::http::StatusCode::BAD_REQUEST,
axum::response::Response::default(),
),
} }
} }
@@ -455,39 +383,16 @@ pub mod endpoint {
let coverart_queue_id = payload.coverart_queue_id; let coverart_queue_id = payload.coverart_queue_id;
match repo::coverart::get_coverart_queue_with_id(&pool, &coverart_queue_id).await { match repo::coverart::get_coverart_queue_with_id(&pool, &coverart_queue_id).await {
Ok(_coverart_queue) => { Ok(coverart_queue) => {
match repo::data::queue::coverart::get_with_coverart_queue_id( match repo::coverart::wipe_data(&pool, &coverart_queue.id).await {
&pool, Ok(id) => {
&coverart_queue_id, response.message = String::from("Success");
) response.data.push(id);
.await (axum::http::StatusCode::OK, axum::Json(response))
{
Ok((_id, file_key, _bucket, _region, _)) => {
let lab_config = crate::util::maze::get_config();
let lr = labyrinth::Labyrinth { config: lab_config };
match lr.delete(&file_key).await {
Ok(_) => {
response.message = String::from("Success");
response.data.push(coverart_queue_id);
(axum::http::StatusCode::OK, axum::Json(response))
}
Err(err) => {
eprintln!("Error: {err:?}");
(
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
axum::Json(response),
)
}
}
} }
Err(err) => { Err(err) => {
response.message = err.to_string(); response.message = err.to_string();
( (axum::http::StatusCode::BAD_REQUEST, axum::Json(response))
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
axum::Json(response),
)
} }
} }
} }
+72 -149
View File
@@ -162,6 +162,7 @@ pub mod endpoint {
if valid { if valid {
match repo::song::insert( match repo::song::insert(
&pool, &pool,
&raw_data,
&file_name, &file_name,
&crate::repo::queue::song::status::PENDING.to_string(), &crate::repo::queue::song::status::PENDING.to_string(),
) )
@@ -171,35 +172,46 @@ pub mod endpoint {
results.push(queued_song); results.push(queued_song);
println!("Uploading to bucket"); println!("Uploading to bucket");
let lab_config = crate::util::maze::get_config(); let s3_endpoint_url =
sienvy::environment::get_env("S3_ENDPOINT_URL");
let bucket_name =
sienvy::environment::get_env("S3_BUCKET_NAME");
let region =
sienvy::environment::get_env("GARAGE_S3_REGION");
let access_key_id = sienvy::environment::get_env(
"GARAGE_DEFAULT_ACCESS_KEY",
);
let secret_key = sienvy::environment::get_env(
"GARAGE_DEFAULT_SECRET_KEY",
);
let lab_config = labyrinth::config::Config {
url: s3_endpoint_url.value,
bucket: bucket_name.value,
region: region.value,
access_key_id: access_key_id.value,
secret_key: secret_key.value,
};
println!("Labyrinth config: {lab_config:?}");
let lr = labyrinth::Labyrinth { config: lab_config }; let lr = labyrinth::Labyrinth { config: lab_config };
let data = labyrinth::Data { let data = labyrinth::Data {
raw_data: copied_raw_data, raw_data: copied_raw_data,
..Default::default() ..Default::default()
}; };
let filename = simodels::song::generate_filename(
println!("Filename: {file_name:?}"); simodels::types::MusicType::FlacExtension,
let file_path = format!("queued/song/{file_name}"); true,
)
.unwrap();
println!("Filename: {filename:?}");
let file_path = format!("queued/song/{filename}");
println!("Path: {file_path:?}"); println!("Path: {file_path:?}");
match lr.upload(&file_path, &data).await { match lr.upload(&file_path, &data).await {
Ok(_res) => { Ok(res) => {
match repo::data::insert( println!("Result: {res:?}");
&pool,
&file_path,
&lr.config.bucket,
&lr.config.region,
&queued_song,
)
.await
{
Ok(_id) => {}
Err(err) => {
eprintln!("Error: {err:?}");
return (axum::http::StatusCode::INTERNAL_SERVER_ERROR, axum::Json(response));
}
}
} }
Err(err) => match err { Err(err) => match err {
labyrinth::Error::Info(err_str) => { labyrinth::Error::Info(err_str) => {
@@ -342,40 +354,28 @@ pub mod endpoint {
)] )]
pub async fn download_queued_song( pub async fn download_queued_song(
axum::Extension(pool): axum::Extension<sqlx::PgPool>, axum::Extension(pool): axum::Extension<sqlx::PgPool>,
axum::extract::Path(song_queue_id): axum::extract::Path<uuid::Uuid>, axum::extract::Path(id): axum::extract::Path<uuid::Uuid>,
) -> (axum::http::StatusCode, axum::response::Response) { ) -> (axum::http::StatusCode, axum::response::Response) {
println!("Id: {song_queue_id}"); println!("Id: {id}");
let lab_config = crate::util::maze::get_config(); match repo::song::get_data(&pool, &id).await {
let lr = labyrinth::Labyrinth { config: lab_config }; Ok(data) => {
let by = axum::body::Bytes::from(data);
let mut response = by.into_response();
let headers = response.headers_mut();
headers.insert(
axum::http::header::CONTENT_TYPE,
"audio/flac".parse().unwrap(),
);
headers.insert(
axum::http::header::CONTENT_DISPOSITION,
format!("attachment; filename=\"{id}.flac\"")
.parse()
.unwrap(),
);
match repo::data::get_with_song_queue_id(&pool, &song_queue_id).await { (axum::http::StatusCode::OK, response)
Ok((id, file_key, _bucket, _region, _)) => match lr.download(&file_key).await { }
Ok(data) => {
let by = axum::body::Bytes::from(data);
let mut response = by.into_response();
let headers = response.headers_mut();
headers.insert(
axum::http::header::CONTENT_TYPE,
"audio/flac".parse().unwrap(),
);
headers.insert(
axum::http::header::CONTENT_DISPOSITION,
format!("attachment; filename=\"{id}.flac\"")
.parse()
.unwrap(),
);
(axum::http::StatusCode::OK, response)
}
Err(err) => {
eprintln!("Error: {err:?}");
(
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
axum::response::Response::default(),
)
}
},
Err(_err) => ( Err(_err) => (
axum::http::StatusCode::BAD_REQUEST, axum::http::StatusCode::BAD_REQUEST,
axum::response::Response::default(), axum::response::Response::default(),
@@ -463,7 +463,7 @@ pub mod endpoint {
) )
)] )]
pub async fn update_song_queue( pub async fn update_song_queue(
axum::extract::Path(song_queue_id): axum::extract::Path<uuid::Uuid>, axum::extract::Path(id): axum::extract::Path<uuid::Uuid>,
axum::Extension(pool): axum::Extension<sqlx::PgPool>, axum::Extension(pool): axum::Extension<sqlx::PgPool>,
mut multipart: axum::extract::Multipart, mut multipart: axum::extract::Multipart,
) -> ( ) -> (
@@ -494,75 +494,15 @@ pub mod endpoint {
match super::is_song_valid(&raw_data).await { match super::is_song_valid(&raw_data).await {
Ok(valid) => { Ok(valid) => {
if valid { if valid {
let lab_config = crate::util::maze::get_config(); match repo::song::update(&pool, &raw_data, &id).await {
let lr = labyrinth::Labyrinth { config: lab_config }; Ok(_) => {
response.message =
println!("Valid song"); String::from(super::super::super::response::SUCCESSFUL);
response.data.push(id);
match repo::data::get_with_song_queue_id(&pool, &song_queue_id).await { (axum::http::StatusCode::OK, axum::Json(response))
Ok((id, file_key, _bucket, _region, _)) => {
match lr.delete(&file_key).await {
Ok(_response) => {
let data = labyrinth::Data {
raw_data,
..Default::default()
};
let filename = simodels::song::generate_filename(
simodels::types::MusicType::FlacExtension,
true,
)
.unwrap();
let new_file_key = format!("queued/song/{filename}");
println!("New key: {new_file_key:?}");
match lr.upload(&new_file_key, &data).await {
Ok(_) => {
match repo::data::update_file_key(
&pool,
&id,
&new_file_key,
)
.await
{
Ok(_) => {
response.message =
super::super::super::response::SUCCESSFUL.to_string();
response.data.push(song_queue_id);
(
axum::http::StatusCode::OK,
axum::Json(response),
)
}
Err(err) => {
response.message = err.to_string();
(
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
axum::Json(response),
)
}
}
}
Err(err) => {
eprintln!("Error: {err:?}");
(
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
axum::Json(response),
)
}
}
}
Err(err) => {
eprintln!("Error: {err:?}");
(
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
axum::Json(response),
)
}
}
} }
Err(err) => { Err(err) => {
eprintln!("Error: {err:?}"); response.message = err.to_string();
( (
axum::http::StatusCode::INTERNAL_SERVER_ERROR, axum::http::StatusCode::INTERNAL_SERVER_ERROR,
axum::Json(response), axum::Json(response),
@@ -599,8 +539,7 @@ pub mod endpoint {
), ),
responses( responses(
(status = 200, description = "Queued song data wiped", body = super::response::wipe_data_from_song_queue::Response), (status = 200, description = "Queued song data wiped", body = super::response::wipe_data_from_song_queue::Response),
(status = 404, description = "Queued song cannot be found", body = super::response::wipe_data_from_song_queue::Response), (status = 404, description = "Queued song cannot be found", body = super::response::wipe_data_from_song_queue::Response)
(status = 500, description = "Error wiping song data", body = super::response::wipe_data_from_song_queue::Response)
) )
)] )]
pub async fn wipe_data_from_song_queue( pub async fn wipe_data_from_song_queue(
@@ -611,37 +550,21 @@ pub mod endpoint {
axum::Json<super::response::wipe_data_from_song_queue::Response>, axum::Json<super::response::wipe_data_from_song_queue::Response>,
) { ) {
let mut response = super::response::wipe_data_from_song_queue::Response::default(); let mut response = super::response::wipe_data_from_song_queue::Response::default();
let song_queue_id = payload.song_queue_id; let id = payload.song_queue_id;
match repo::song::get_song_queue(&pool, &song_queue_id).await { match repo::song::get_song_queue(&pool, &id).await {
Ok(_song_queue) => { Ok(song_queue) => match repo::song::wipe_data(&pool, &song_queue.id).await {
match repo::data::get_with_song_queue_id(&pool, &song_queue_id).await { Ok(wiped_id) => {
Ok((_id, file_key, _bucket, _region, _)) => { response.message = String::from("Success");
let lab_config = crate::util::maze::get_config(); response.data.push(wiped_id);
let lr = labyrinth::Labyrinth { config: lab_config };
match lr.delete(&file_key).await { (axum::http::StatusCode::OK, axum::Json(response))
Ok(_) => {
response.message = String::from("Success");
response.data.push(song_queue_id);
(axum::http::StatusCode::OK, axum::Json(response))
}
Err(err) => {
eprintln!("Error: {err:?}");
(
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
axum::Json(response),
)
}
}
}
Err(err) => {
response.message = err.to_string();
(axum::http::StatusCode::NOT_FOUND, axum::Json(response))
}
} }
} Err(err) => {
response.message = err.to_string();
(axum::http::StatusCode::NOT_FOUND, axum::Json(response))
}
},
Err(err) => { Err(err) => {
response.message = err.to_string(); response.message = err.to_string();
(axum::http::StatusCode::NOT_FOUND, axum::Json(response)) (axum::http::StatusCode::NOT_FOUND, axum::Json(response))
+69 -140
View File
@@ -139,62 +139,46 @@ pub mod endpoint {
.unwrap(); .unwrap();
song.directory = sienvy::environment::get_root_directory().value; song.directory = sienvy::environment::get_root_directory().value;
let lab_config = crate::util::maze::get_config(); match repo_queue::song::get_data(&pool, &payload.song_queue_id).await {
let lr = labyrinth::Labyrinth { config: lab_config }; Ok(data) => {
song.data = data;
match repo_queue::data::get_with_song_queue_id(&pool, &payload.song_queue_id).await { let dir = std::path::Path::new(&song.directory);
Ok((_id, file_key, _bucket, _region, _)) => match lr.download(&file_key).await { if !dir.exists() {
Ok(data) => { println!("Creating directory");
song.data = data; match std::fs::create_dir_all(dir) {
let dir = std::path::Path::new(&song.directory); Ok(_) => {
if !dir.exists() { println!("Successfully created directory");
println!("Creating directory");
match std::fs::create_dir_all(dir) {
Ok(_) => {
println!("Successfully created directory");
}
Err(err) => {
eprintln!("Error: Unable to create the directory {err:?}");
}
} }
}
song.file_key = format!("processed/song/{}", song.filename);
let data_of_song = labyrinth::Data {
raw_data: song.data.clone(),
..Default::default()
};
match lr.upload(&song.file_key, &data_of_song).await {
Ok(_resp) => match repo::song::insert(&pool, &song).await {
Ok((date_created, id)) => {
song.id = id;
song.date_created = Some(date_created);
response.message = String::from("Successful");
response.data.push(song);
(axum::http::StatusCode::OK, axum::Json(response))
}
Err(err) => {
response.message =
format!("{:?} song {:?}", err.to_string(), song);
(axum::http::StatusCode::BAD_REQUEST, axum::Json(response))
}
},
Err(err) => { Err(err) => {
eprintln!("Error: {err:?}"); eprintln!("Error: Unable to create the directory {err:?}");
(
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
axum::Json(response),
)
} }
} }
} }
Err(err) => {
eprintln!("Error: {err:?}"); match song.save_to_filesystem() {
(axum::http::StatusCode::BAD_REQUEST, axum::Json(response)) Ok(_) => match repo::song::insert(&pool, &song).await {
Ok((date_created, id)) => {
song.id = id;
song.date_created = Some(date_created);
response.message = String::from("Successful");
response.data.push(song);
(axum::http::StatusCode::OK, axum::Json(response))
}
Err(err) => {
response.message = format!("{:?} song {:?}", err.to_string(), song);
(axum::http::StatusCode::BAD_REQUEST, axum::Json(response))
}
},
Err(err) => {
response.message = err.to_string();
(
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
axum::Json(response),
)
}
} }
}, }
Err(err) => { Err(err) => {
response.message = err.to_string(); response.message = err.to_string();
(axum::http::StatusCode::BAD_REQUEST, axum::Json(response)) (axum::http::StatusCode::BAD_REQUEST, axum::Json(response))
@@ -296,90 +280,40 @@ pub mod endpoint {
axum::extract::Path(id): axum::extract::Path<uuid::Uuid>, axum::extract::Path(id): axum::extract::Path<uuid::Uuid>,
) -> impl IntoResponse { ) -> impl IntoResponse {
match repo::song::get_song(&pool, &id).await { match repo::song::get_song(&pool, &id).await {
Ok(mut song) => { Ok(song) => {
let lab_config = crate::util::maze::get_config(); let song_path = song.song_path().unwrap();
let lr = labyrinth::Labyrinth { config: lab_config }; let path = std::path::Path::new(&song_path);
match lr.download(&song.file_key).await { if !path.starts_with(&song.directory) || !path.exists() {
Ok(data) => { return Err((axum::http::StatusCode::NOT_FOUND, "File not found"));
song.filename = simodels::song::generate_filename(
simodels::types::MusicType::FlacExtension,
true,
)
.unwrap();
// TODO: At some point, directory will no longer be needed with s3
song.directory = sienvy::environment::get_root_directory().value;
song.data = data;
match song.save_to_filesystem() {
Ok(_) => {
let song_path = song.song_path().unwrap();
let path = std::path::Path::new(&song_path);
if !path.starts_with(&song.directory) || !path.exists() {
return Err((
axum::http::StatusCode::NOT_FOUND,
"File not found",
));
}
let file = match tokio::fs::File::open(&path).await {
Ok(file) => file,
Err(_) => {
return Err((
axum::http::StatusCode::NOT_FOUND,
"File not found",
));
}
};
let file_size = match file.metadata().await {
Ok(meta) => meta.len(),
Err(_) => {
return Err((
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
"Could not read file",
));
}
};
let mime = mime_guess::from_path(path).first_or_octet_stream();
let stream = tokio_util::io::ReaderStream::new(file);
let rep = axum::response::Response::builder()
.header("content-type", mime.to_string())
.header("accept-ranges", "bytes")
.header("content-length", file_size.to_string())
.body(axum::body::Body::from_stream(stream))
.unwrap();
match song.remove_from_filesystem() {
Ok(_) => Ok(rep),
Err(err) => {
eprintln!("Error: {err:?}");
Err((
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
"Could not read file",
))
}
}
}
Err(err) => {
eprintln!("Error: {err:?}");
Err((
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
"Could not find file",
))
}
}
}
Err(err) => {
eprintln!("Error: {err:?}");
Err((
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
"Could not find file",
))
}
} }
let file = match tokio::fs::File::open(&path).await {
Ok(file) => file,
Err(_) => return Err((axum::http::StatusCode::NOT_FOUND, "File not found")),
};
let file_size = match file.metadata().await {
Ok(meta) => meta.len(),
Err(_) => {
return Err((
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
"Could not read file",
));
}
};
let mime = mime_guess::from_path(path).first_or_octet_stream();
let stream = tokio_util::io::ReaderStream::new(file);
let rep = axum::response::Response::builder()
.header("content-type", mime.to_string())
.header("accept-ranges", "bytes")
.header("content-length", file_size.to_string())
.body(axum::body::Body::from_stream(stream))
.unwrap();
Ok(rep)
} }
Err(_err) => Err(( Err(_err) => Err((
axum::http::StatusCode::INTERNAL_SERVER_ERROR, axum::http::StatusCode::INTERNAL_SERVER_ERROR,
@@ -403,11 +337,8 @@ pub mod endpoint {
axum::Extension(pool): axum::Extension<sqlx::PgPool>, axum::Extension(pool): axum::Extension<sqlx::PgPool>,
axum::extract::Path(id): axum::extract::Path<uuid::Uuid>, axum::extract::Path(id): axum::extract::Path<uuid::Uuid>,
) -> (axum::http::StatusCode, axum::response::Response) { ) -> (axum::http::StatusCode, axum::response::Response) {
let lab_config = crate::util::maze::get_config();
let lr = labyrinth::Labyrinth { config: lab_config };
match repo::song::get_song(&pool, &id).await { match repo::song::get_song(&pool, &id).await {
Ok(song) => match lr.download(&song.file_key).await { Ok(song) => match simodels::song::io::to_data(&song) {
Ok(data) => { Ok(data) => {
let bytes = axum::body::Bytes::from(data); let bytes = axum::body::Bytes::from(data);
let mut response = bytes.into_response(); let mut response = bytes.into_response();
@@ -456,8 +387,6 @@ pub mod endpoint {
axum::Json<super::response::delete_song::Response>, axum::Json<super::response::delete_song::Response>,
) { ) {
let mut response = super::response::delete_song::Response::default(); let mut response = super::response::delete_song::Response::default();
let lab_config = crate::util::maze::get_config();
let lr = labyrinth::Labyrinth { config: lab_config };
match repo::song::get_song(&pool, &id).await { match repo::song::get_song(&pool, &id).await {
Ok(song) => { Ok(song) => {
@@ -481,7 +410,7 @@ pub mod endpoint {
match repo::coverart::delete_coverart(&pool, &coverart.id).await match repo::coverart::delete_coverart(&pool, &coverart.id).await
{ {
Ok(deleted_coverart) => { Ok(deleted_coverart) => {
match lr.delete(&song.file_key).await { match song.remove_from_filesystem() {
Ok(_) => match coverart.remove_from_filesystem() { Ok(_) => match coverart.remove_from_filesystem() {
Ok(_) => { Ok(_) => {
response.message = String::from( response.message = String::from(
@@ -499,7 +428,7 @@ pub mod endpoint {
} }
}, },
Err(err) => { Err(err) => {
eprintln!("Error: {err:?}"); response.message = err.to_string();
(axum::http::StatusCode::INTERNAL_SERVER_ERROR, axum::Json(response)) (axum::http::StatusCode::INTERNAL_SERVER_ERROR, axum::Json(response))
} }
} }
-6
View File
@@ -1,6 +0,0 @@
pub mod auth;
pub mod callers;
pub mod config;
pub mod db;
pub mod repo;
pub mod util;
+358 -478
View File
File diff suppressed because it is too large Load Diff
+31 -50
View File
@@ -7,14 +7,13 @@ pub async fn create(
) -> Result<uuid::Uuid, sqlx::Error> { ) -> Result<uuid::Uuid, sqlx::Error> {
let result = sqlx::query( let result = sqlx::query(
r#" r#"
INSERT INTO "coverart" (title, directory, filename, file_type, file_key, song_id) VALUES($1, $2, $3, $4, $5, $6) RETURNING id; INSERT INTO "coverart" (title, directory, filename, file_type, song_id) VALUES($1, $2, $3, $4, $5) RETURNING id;
"#, "#,
) )
.bind(&coverart.title) .bind(&coverart.title)
.bind(&coverart.directory) .bind(&coverart.directory)
.bind(&coverart.filename) .bind(&coverart.filename)
.bind(&coverart.file_type) .bind(&coverart.file_type)
.bind(&coverart.file_key)
.bind(song_id) .bind(song_id)
.fetch_one(pool) .fetch_one(pool)
.await .await
@@ -40,7 +39,7 @@ pub async fn get_coverart(
) -> Result<simodels::coverart::CoverArt, sqlx::Error> { ) -> Result<simodels::coverart::CoverArt, sqlx::Error> {
let result = sqlx::query( let result = sqlx::query(
r#" r#"
SELECT id, title, directory, filename, file_type, file_key, song_id FROM "coverart" WHERE id = $1; SELECT id, title, directory, filename, file_type, song_id FROM "coverart" WHERE id = $1;
"#, "#,
) )
.bind(id) .bind(id)
@@ -72,10 +71,6 @@ pub async fn get_coverart(
.try_get("file_type") .try_get("file_type")
.map_err(|_e| sqlx::Error::RowNotFound) .map_err(|_e| sqlx::Error::RowNotFound)
.unwrap(), .unwrap(),
file_key: row
.try_get("file_key")
.map_err(|_e| sqlx::Error::RowNotFound)
.unwrap(),
song_id: row song_id: row
.try_get("song_id") .try_get("song_id")
.map_err(|_e| sqlx::Error::RowNotFound) .map_err(|_e| sqlx::Error::RowNotFound)
@@ -92,7 +87,7 @@ pub async fn get_coverart_with_song_id(
) -> Result<simodels::coverart::CoverArt, sqlx::Error> { ) -> Result<simodels::coverart::CoverArt, sqlx::Error> {
let result = sqlx::query( let result = sqlx::query(
r#" r#"
SELECT id, title, directory, filename, file_type, file_key, song_id FROM "coverart" WHERE song_id = $1; SELECT id, title, directory, filename, file_type, song_id FROM "coverart" WHERE song_id = $1;
"#, "#,
) )
.bind(song_id) .bind(song_id)
@@ -124,10 +119,6 @@ pub async fn get_coverart_with_song_id(
.try_get("file_type") .try_get("file_type")
.map_err(|_e| sqlx::Error::RowNotFound) .map_err(|_e| sqlx::Error::RowNotFound)
.unwrap(), .unwrap(),
file_key: row
.try_get("file_key")
.map_err(|_e| sqlx::Error::RowNotFound)
.unwrap(),
data: Vec::new(), data: Vec::new(),
song_id: row song_id: row
.try_get("song_id") .try_get("song_id")
@@ -146,7 +137,7 @@ pub async fn delete_coverart(
r#" r#"
DELETE FROM "coverart" DELETE FROM "coverart"
WHERE id = $1 WHERE id = $1
RETURNING id, title, directory, filename, file_type, file_key, song_id RETURNING id, title, directory, filename, file_type, song_id
"#, "#,
) )
.bind(id) .bind(id)
@@ -157,43 +148,33 @@ pub async fn delete_coverart(
}); });
match result { match result {
Ok(row) => parse_row(&row).await, Ok(row) => Ok(simodels::coverart::CoverArt {
id: row
.try_get("id")
.map_err(|_e| sqlx::Error::RowNotFound)
.unwrap(),
title: row
.try_get("title")
.map_err(|_e| sqlx::Error::RowNotFound)
.unwrap(),
directory: row
.try_get("directory")
.map_err(|_e| sqlx::Error::RowNotFound)
.unwrap(),
filename: row
.try_get("filename")
.map_err(|_e| sqlx::Error::RowNotFound)
.unwrap(),
file_type: row
.try_get("file_type")
.map_err(|_e| sqlx::Error::RowNotFound)
.unwrap(),
song_id: row
.try_get("song_id")
.map_err(|_e| sqlx::Error::RowNotFound)
.unwrap(),
data: Vec::new(),
}),
Err(_err) => Err(sqlx::Error::RowNotFound), Err(_err) => Err(sqlx::Error::RowNotFound),
} }
} }
async fn parse_row(
row: &sqlx::postgres::PgRow,
) -> Result<simodels::coverart::CoverArt, sqlx::Error> {
Ok(simodels::coverart::CoverArt {
id: row
.try_get("id")
.map_err(|_e| sqlx::Error::RowNotFound)
.unwrap(),
title: row
.try_get("title")
.map_err(|_e| sqlx::Error::RowNotFound)
.unwrap(),
directory: row
.try_get("directory")
.map_err(|_e| sqlx::Error::RowNotFound)
.unwrap(),
filename: row
.try_get("filename")
.map_err(|_e| sqlx::Error::RowNotFound)
.unwrap(),
file_type: row
.try_get("file_type")
.map_err(|_e| sqlx::Error::RowNotFound)
.unwrap(),
file_key: row
.try_get("file_key")
.map_err(|_e| sqlx::Error::RowNotFound)
.unwrap(),
song_id: row
.try_get("song_id")
.map_err(|_e| sqlx::Error::RowNotFound)
.unwrap(),
data: Vec::new(),
})
}
+82 -2
View File
@@ -1,11 +1,16 @@
use sqlx::Row; use sqlx::Row;
pub async fn insert(pool: &sqlx::PgPool, file_type: &str) -> Result<uuid::Uuid, sqlx::Error> { pub async fn insert(
pool: &sqlx::PgPool,
data: &Vec<u8>,
file_type: &str,
) -> Result<uuid::Uuid, sqlx::Error> {
let result = sqlx::query( let result = sqlx::query(
r#" r#"
INSERT INTO "coverartQueue" (file_type) VALUES($1) RETURNING id; INSERT INTO "coverartQueue" (data, file_type) VALUES($1, $2) RETURNING id;
"#, "#,
) )
.bind(data)
.bind(file_type) .bind(file_type)
.fetch_one(pool) .fetch_one(pool)
.await .await
@@ -115,3 +120,78 @@ pub async fn get_coverart_queue_with_song_queue_id(
Err(_) => Err(sqlx::Error::RowNotFound), Err(_) => Err(sqlx::Error::RowNotFound),
} }
} }
pub async fn get_coverart_queue_data_with_id(
pool: &sqlx::PgPool,
id: &uuid::Uuid,
) -> Result<Vec<u8>, sqlx::Error> {
let result = sqlx::query(
r#"
SELECT data FROM "coverartQueue" WHERE id = $1;
"#,
)
.bind(id)
.fetch_one(pool)
.await
.map_err(|e| {
eprintln!("Error querying data: {e:?}");
});
match result {
Ok(row) => Ok(row
.try_get("data")
.map_err(|_e| sqlx::Error::RowNotFound)
.unwrap()),
Err(_) => Err(sqlx::Error::RowNotFound),
}
}
pub async fn get_coverart_queue_data_with_song_queue_id(
pool: &sqlx::PgPool,
song_queue_id: &uuid::Uuid,
) -> Result<Vec<u8>, sqlx::Error> {
let result = sqlx::query(
r#"
SELECT data FROM "coverartQueue" WHERE song_queue_id = $1;
"#,
)
.bind(song_queue_id)
.fetch_one(pool)
.await
.map_err(|e| {
eprintln!("Error querying data: {e}");
});
match result {
Ok(row) => Ok(row
.try_get("data")
.map_err(|_e| sqlx::Error::RowNotFound)
.unwrap()),
Err(_) => Err(sqlx::Error::RowNotFound),
}
}
pub async fn wipe_data(
pool: &sqlx::PgPool,
coverart_queue_id: &uuid::Uuid,
) -> Result<uuid::Uuid, sqlx::Error> {
let result = sqlx::query(
r#"
UPDATE "coverartQueue" SET data = NULL WHERE id = $1 RETURNING id;
"#,
)
.bind(coverart_queue_id)
.fetch_one(pool)
.await
.map_err(|e| {
eprintln!("Error updating query: {e}");
});
match result {
Ok(row) => Ok(row
.try_get("id")
.map_err(|_e| sqlx::Error::RowNotFound)
.unwrap()),
Err(_) => Err(sqlx::Error::RowNotFound),
}
}
-204
View File
@@ -1,204 +0,0 @@
use sqlx::Row;
pub async fn insert(
pool: &sqlx::PgPool,
file_key: &str,
bucket: &str,
region: &str,
song_queue_id: &uuid::Uuid,
) -> Result<uuid::Uuid, sqlx::Error> {
match sqlx::query(
r#"
INSERT INTO "songQueueData" (file_key, bucket, region, song_queue_id) VALUES($1, $2, $3, $4) RETURNING id;
"#,
)
.bind(file_key)
.bind(bucket)
.bind(region)
.bind(song_queue_id)
.fetch_one(pool).await {
Ok(row) => {
let id: uuid::Uuid = row.try_get("id")?;
Ok(id)
}
Err(_err) => Err(sqlx::Error::RowNotFound),
}
}
pub async fn update_file_key(
pool: &sqlx::PgPool,
id: &uuid::Uuid,
file_key: &str,
) -> Result<(), sqlx::Error> {
match sqlx::query(
r#"
UPDATE "songQueueData" SET file_key = $1 WHERE id = $2;
"#,
)
.bind(file_key)
.bind(id)
.execute(pool)
.await
{
Ok(_row) => Ok(()),
Err(_) => Err(sqlx::Error::RowNotFound),
}
}
pub async fn get(
pool: &sqlx::PgPool,
id: &uuid::Uuid,
) -> Result<(uuid::Uuid, String, String, String, uuid::Uuid), sqlx::Error> {
match sqlx::query(
r#"
SELECT id, file_key, bucket, region, song_queue_id FROM "songQueueData"
WHERE id = $1
"#,
)
.bind(id)
.fetch_one(pool)
.await
{
Ok(row) => {
let file_key: String = row.try_get("file_key")?;
let bucket: String = row.try_get("bucket")?;
let region: String = row.try_get("region")?;
let song_queue_id: uuid::Uuid = row.try_get("song_queue_id")?;
Ok((*id, file_key, bucket, region, song_queue_id))
}
Err(err) => Err(err),
}
}
pub async fn get_with_song_queue_id(
pool: &sqlx::PgPool,
song_queue_id: &uuid::Uuid,
) -> Result<(uuid::Uuid, String, String, String, uuid::Uuid), sqlx::Error> {
match sqlx::query(
r#"
SELECT id, file_key, bucket, region, song_queue_id FROM "songQueueData"
WHERE song_queue_id = $1
"#,
)
.bind(song_queue_id)
.fetch_one(pool)
.await
{
Ok(row) => {
let id: uuid::Uuid = row.try_get("id")?;
let file_key: String = row.try_get("file_key")?;
let bucket: String = row.try_get("bucket")?;
let region: String = row.try_get("region")?;
Ok((id, file_key, bucket, region, *song_queue_id))
}
Err(err) => Err(err),
}
}
pub mod queue {
pub mod coverart {
use sqlx::Row;
pub async fn insert(
pool: &sqlx::PgPool,
file_key: &str,
bucket: &str,
region: &str,
coverart_queue_id: &uuid::Uuid,
) -> Result<uuid::Uuid, sqlx::Error> {
match sqlx::query(
r#"
INSERT INTO "coverartQueueData" (file_key, bucket, region, coverart_queue_id)
VALUES($1, $2, $3, $4) RETURNING id;
"#,
)
.bind(file_key)
.bind(bucket)
.bind(region)
.bind(coverart_queue_id)
.fetch_one(pool)
.await
{
Ok(row) => {
let id: uuid::Uuid = row.try_get("id")?;
Ok(id)
}
Err(_err) => Err(sqlx::Error::RowNotFound),
}
}
pub async fn update_file_key(
pool: &sqlx::PgPool,
id: &uuid::Uuid,
file_key: &str,
) -> Result<(), sqlx::Error> {
match sqlx::query(
r#"
UPDATE "coverartQueueData" SET file_key = $1 WHERE id = $2;
"#,
)
.bind(file_key)
.bind(id)
.execute(pool)
.await
{
Ok(_row) => Ok(()),
Err(_) => Err(sqlx::Error::RowNotFound),
}
}
pub async fn get(
pool: &sqlx::PgPool,
id: &uuid::Uuid,
) -> Result<(uuid::Uuid, String, String, String, uuid::Uuid), sqlx::Error> {
match sqlx::query(
r#"
SELECT id, file_key, bucket, region, coverart_queue_id FROM "coverartQueueData"
WHERE id = $1
"#,
)
.bind(id)
.fetch_one(pool)
.await
{
Ok(row) => {
let file_key: String = row.try_get("file_key")?;
let bucket: String = row.try_get("bucket")?;
let region: String = row.try_get("region")?;
let coverart_queue_id: uuid::Uuid = row.try_get("coverart_queue_id")?;
Ok((*id, file_key, bucket, region, coverart_queue_id))
}
Err(err) => Err(err),
}
}
pub async fn get_with_coverart_queue_id(
pool: &sqlx::PgPool,
coverart_queue_id: &uuid::Uuid,
) -> Result<(uuid::Uuid, String, String, String, uuid::Uuid), sqlx::Error> {
match sqlx::query(
r#"
SELECT id, file_key, bucket, region, coverart_queue_id FROM "coverartQueueData"
WHERE coverart_queue_id = $1
"#,
)
.bind(coverart_queue_id)
.fetch_one(pool)
.await
{
Ok(row) => {
let id: uuid::Uuid = row.try_get("id")?;
let file_key: String = row.try_get("file_key")?;
let bucket: String = row.try_get("bucket")?;
let region: String = row.try_get("region")?;
Ok((id, file_key, bucket, region, *coverart_queue_id))
}
Err(err) => Err(err),
}
}
}
}
-1
View File
@@ -1,4 +1,3 @@
pub mod coverart; pub mod coverart;
pub mod data;
pub mod metadata; pub mod metadata;
pub mod song; pub mod song;
+51 -1
View File
@@ -24,14 +24,16 @@ pub mod dbtype {
pub async fn insert( pub async fn insert(
pool: &sqlx::PgPool, pool: &sqlx::PgPool,
data: &Vec<u8>,
filename: &String, filename: &String,
status: &String, status: &String,
) -> Result<uuid::Uuid, sqlx::Error> { ) -> Result<uuid::Uuid, sqlx::Error> {
let result = sqlx::query( let result = sqlx::query(
r#" r#"
INSERT INTO "songQueue" (filename, status) VALUES($1, $2) RETURNING id; INSERT INTO "songQueue" (data, filename, status) VALUES($1, $2, $3) RETURNING id;
"#, "#,
) )
.bind(data)
.bind(filename) .bind(filename)
.bind(status) .bind(status)
.fetch_one(pool) .fetch_one(pool)
@@ -251,3 +253,51 @@ pub async fn get_song_queue(
Err(_err) => Err(sqlx::Error::RowNotFound), 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),
}
}
+3 -16
View File
@@ -6,8 +6,8 @@ pub async fn insert(
) -> Result<(time::OffsetDateTime, uuid::Uuid), sqlx::Error> { ) -> Result<(time::OffsetDateTime, uuid::Uuid), sqlx::Error> {
let result = sqlx::query( let result = sqlx::query(
r#" r#"
INSERT INTO "song" (title, artist, album_artist, album, genre, year, track, disc, track_count, disc_count, duration, audio_type, filename, directory, file_key, user_id) INSERT INTO "song" (title, artist, album_artist, album, genre, year, track, disc, track_count, disc_count, duration, audio_type, filename, directory, user_id)
VALUES($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16) RETURNING date_created, id; VALUES($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15) RETURNING date_created, id;
"# "#
) )
.bind(&song.title) .bind(&song.title)
@@ -24,7 +24,6 @@ pub async fn insert(
.bind(&song.audio_type) .bind(&song.audio_type)
.bind(&song.filename) .bind(&song.filename)
.bind(&song.directory) .bind(&song.directory)
.bind(&song.file_key)
.bind(song.user_id) .bind(song.user_id)
.fetch_one(pool) .fetch_one(pool)
.await .await
@@ -134,10 +133,6 @@ pub async fn get_song(
.try_get("directory") .try_get("directory")
.map_err(|_e| sqlx::Error::RowNotFound) .map_err(|_e| sqlx::Error::RowNotFound)
.unwrap(), .unwrap(),
file_key: row
.try_get("file_key")
.map_err(|_e| sqlx::Error::RowNotFound)
.unwrap(),
date_created: Some(date_created_time), date_created: Some(date_created_time),
user_id: row user_id: row
.try_get("user_id") .try_get("user_id")
@@ -233,10 +228,6 @@ pub async fn get_all_songs(pool: &sqlx::PgPool) -> Result<Vec<simodels::song::So
.try_get("directory") .try_get("directory")
.map_err(|_e| sqlx::Error::RowNotFound) .map_err(|_e| sqlx::Error::RowNotFound)
.unwrap(), .unwrap(),
file_key: row
.try_get("file_key")
.map_err(|_e| sqlx::Error::RowNotFound)
.unwrap(),
date_created: Some(date_created_time), date_created: Some(date_created_time),
user_id: row user_id: row
.try_get("user_id") .try_get("user_id")
@@ -263,7 +254,7 @@ pub async fn delete_song(
r#" r#"
DELETE FROM "song" DELETE FROM "song"
WHERE id = $1 WHERE id = $1
RETURNING id, title, artist, album, album_artist, genre, year, disc, track, track_count, disc_count, duration, audio_type, date_created, filename, directory, file_key, user_id RETURNING id, title, artist, album, album_artist, genre, year, disc, track, track_count, disc_count, duration, audio_type, date_created, filename, directory, user_id
"#, "#,
) )
.bind(id) .bind(id)
@@ -341,10 +332,6 @@ pub async fn delete_song(
.try_get("directory") .try_get("directory")
.map_err(|_e| sqlx::Error::RowNotFound) .map_err(|_e| sqlx::Error::RowNotFound)
.unwrap(), .unwrap(),
file_key: row
.try_get("file_key")
.map_err(|_e| sqlx::Error::RowNotFound)
.unwrap(),
date_created: Some(date_created_time), date_created: Some(date_created_time),
user_id: row user_id: row
.try_get("user_id") .try_get("user_id")
-17
View File
@@ -1,17 +0,0 @@
pub mod maze {
pub fn get_config() -> labyrinth::config::Config {
let s3_endpoint_url = sienvy::environment::get_env("S3_ENDPOINT_URL");
let bucket_name = sienvy::environment::get_env("S3_BUCKET_NAME");
let region = sienvy::environment::get_env("GARAGE_S3_REGION");
let access_key_id = sienvy::environment::get_env("GARAGE_DEFAULT_ACCESS_KEY");
let secret_key = sienvy::environment::get_env("GARAGE_DEFAULT_SECRET_KEY");
labyrinth::config::Config {
url: s3_endpoint_url.value,
bucket: bucket_name.value,
region: region.value,
access_key_id: access_key_id.value,
secret_key: secret_key.value,
}
}
}
+2 -18
View File
@@ -6,17 +6,10 @@ CREATE TABLE IF NOT EXISTS "songQueue" (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(), id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
filename TEXT NOT NULL, filename TEXT NOT NULL,
status TEXT CHECK (status IN ('pending', 'ready', 'processing', 'done')), status TEXT CHECK (status IN ('pending', 'ready', 'processing', 'done')),
data BYTEA NULL,
user_id UUID NULL user_id UUID NULL
); );
CREATE TABLE IF NOT EXISTS "songQueueData" (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
file_key TEXT NOT NULL,
bucket TEXT NOT NULL,
region TEXT NOT NULL,
song_queue_id UUID NOT NULL
);
-- Table to store queued metadata -- Table to store queued metadata
CREATE TABLE IF NOT EXISTS "metadataQueue" ( CREATE TABLE IF NOT EXISTS "metadataQueue" (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(), id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
@@ -28,18 +21,11 @@ CREATE TABLE IF NOT EXISTS "metadataQueue" (
-- Table to store queued coverart -- Table to store queued coverart
CREATE TABLE IF NOT EXISTS "coverartQueue" ( CREATE TABLE IF NOT EXISTS "coverartQueue" (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(), id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
data BYTEA NULL,
file_type TEXT NOT NULL, file_type TEXT NOT NULL,
song_queue_id UUID NULL song_queue_id UUID NULL
); );
CREATE TABLE IF NOT EXISTS "coverartQueueData" (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
file_key TEXT NOT NULL,
bucket TEXT NOT NULL,
region TEXT NOT NULL,
coverart_queue_id UUID NOT NULL
);
-- Create an index for better query performance -- Create an index for better query performance
CREATE INDEX metadata_queue_data_metadata ON "metadataQueue" USING gin (metadata); CREATE INDEX metadata_queue_data_metadata ON "metadataQueue" USING gin (metadata);
@@ -61,7 +47,6 @@ CREATE TABLE IF NOT EXISTS "song" (
date_created timestamptz DEFAULT now(), date_created timestamptz DEFAULT now(),
filename TEXT NOT NULL, filename TEXT NOT NULL,
directory TEXT NOT NULL, directory TEXT NOT NULL,
file_key TEXT NOT NULL,
user_id UUID NULL user_id UUID NULL
); );
@@ -72,6 +57,5 @@ CREATE TABLE IF NOT EXISTS "coverart" (
directory TEXT NOT NULL, directory TEXT NOT NULL,
filename TEXT NOT NULL, filename TEXT NOT NULL,
file_type TEXT NOT NULL, file_type TEXT NOT NULL,
file_key TEXT NOT NULL,
song_id UUID NOT NULL song_id UUID NOT NULL
); );
@@ -1,11 +1,6 @@
-- Add migration script here -- Add migration script here
INSERT INTO "song" (id, title, artist, album_artist, album, genre, year, track, disc, track_count, disc_count, duration, audio_type, date_created, filename, directory, file_key, user_id) INSERT INTO "song" (id, title, artist, album_artist, album, genre, year, track, disc, track_count, disc_count, duration, audio_type, date_created, filename, directory, user_id) VALUES('44cf7940-34ff-489f-9124-d0ec90a55af9', 'Hypocrite Like The Rest', 'Kuoth', 'Kuoth', 'I', 'Alternative Hip-Hop', 2020, 1, 1, 9, 1, 139, 'flac', '2020-01-01 13:00:00-05', 'track01.flac', 'tests/I', '47491f9b-725a-4ba4-b9a5-711e1be46670');
VALUES('44cf7940-34ff-489f-9124-d0ec90a55af9', 'Hypocrite Like The Rest', 'Kuoth', 'Kuoth', 'I', 'Alternative Hip-Hop', 2020, 1, 1, 9, 1, 139, 'flac', '2020-01-01 13:00:00-05', 'track01.flac', 'tests/I', 'processed/song/track01.flac', '47491f9b-725a-4ba4-b9a5-711e1be46670'); INSERT INTO "coverart" (id, title, directory, filename, file_type, song_id) VALUES('996122cd-5ae9-4013-9934-60768d3006ed', 'I', 'tests/I', 'Coverart-1.jpg', 'jpeg', '44cf7940-34ff-489f-9124-d0ec90a55af9');
INSERT INTO "coverart" (id, title, directory, filename, file_type, file_key, song_id) INSERT INTO "song" (id, title, artist, album_artist, album, genre, year, track, disc, track_count, disc_count, duration, audio_type, date_created, filename, directory, user_id) VALUES('94cf7940-34ff-489f-9124-d0ec90a55af4', 'It''s Too Late', 'Kuoth', 'Kuoth', 'I', 'Alternative Hip-Hop', 2020, 2, 1, 9, 1, 116, 'flac', '2020-01-01 13:01:00-05', 'track02.flac', 'tests/I', '47491f9b-725a-4ba4-b9a5-711e1be46670');
VALUES('996122cd-5ae9-4013-9934-60768d3006ed', 'I', 'tests/I', 'Coverart-1.jpg', 'jpeg', 'processed/coverart/Coverart-1.jpg', '44cf7940-34ff-489f-9124-d0ec90a55af9'); INSERT INTO "coverart" (id, title, directory, filename, file_type, song_id) VALUES('d96122cd-5ae9-4013-9934-60768d3006e9', 'I', 'tests/I', 'Coverart-2.jpg', 'jpeg', '94cf7940-34ff-489f-9124-d0ec90a55af4');
INSERT INTO "song" (id, title, artist, album_artist, album, genre, year, track, disc, track_count, disc_count, duration, audio_type, date_created, filename, directory, file_key, user_id)
VALUES('94cf7940-34ff-489f-9124-d0ec90a55af4', 'It''s Too Late', 'Kuoth', 'Kuoth', 'I', 'Alternative Hip-Hop', 2020, 2, 1, 9, 1, 116, 'flac', '2020-01-01 13:01:00-05', 'track02.flac', 'tests/I', 'processed/song/track02.flac', '47491f9b-725a-4ba4-b9a5-711e1be46670');
INSERT INTO "coverart" (id, title, directory, filename, file_type, file_key, song_id)
VALUES('d96122cd-5ae9-4013-9934-60768d3006e9', 'I', 'tests/I', 'Coverart-2.jpg', 'jpeg', 'processed/coverart/Coverart-2.jpg', '94cf7940-34ff-489f-9124-d0ec90a55af4');