- Web: Setup Storybook, added addons, configured Tailwind, added stories for UI components. - Backend: Updated API router, database, workers, and auth in common. - Stream Server: Removed SQLx queries and updated auth. - Docs & Scripts: Updated documentation and recovery scripts.
79 lines
2.5 KiB
Bash
Executable file
79 lines
2.5 KiB
Bash
Executable file
#!/bin/bash
|
|
set -e
|
|
|
|
API_URL="http://localhost:8080/api/v1"
|
|
EMAIL="monitor_$(date +%s)@veza.app"
|
|
PASSWORD="Password123!"
|
|
USERNAME="monitor_user_$(date +%s)"
|
|
|
|
echo "🔹 1. Registering User ($EMAIL)..."
|
|
REGISTER_PAYLOAD=$(jq -n \
|
|
--arg email "$EMAIL" \
|
|
--arg password "$PASSWORD" \
|
|
--arg username "$USERNAME" \
|
|
'{email: $email, password: $password, password_confirmation: $password, username: $username, full_name: "Monitor User"}')
|
|
|
|
curl -s -X POST "$API_URL/auth/register" \
|
|
-H "Content-Type: application/json" \
|
|
-d "$REGISTER_PAYLOAD" > register_response.json
|
|
|
|
echo " Response: $(cat register_response.json)"
|
|
|
|
echo "🔹 2. Logging In..."
|
|
LOGIN_PAYLOAD=$(jq -n \
|
|
--arg email "$EMAIL" \
|
|
--arg password "$PASSWORD" \
|
|
'{email: $email, password: $password}')
|
|
|
|
LOGIN_RESPONSE=$(curl -s -X POST "$API_URL/auth/login" \
|
|
-H "Content-Type: application/json" \
|
|
-d "$LOGIN_PAYLOAD")
|
|
|
|
echo " Login Response: $LOGIN_RESPONSE"
|
|
|
|
# Extract Token
|
|
TOKEN=$(echo "$LOGIN_RESPONSE" | jq -r '.data.token.access_token')
|
|
|
|
if [ "$TOKEN" == "null" ] || [ -z "$TOKEN" ]; then
|
|
echo "❌ Login Failed."
|
|
exit 1
|
|
fi
|
|
echo " ✅ Token acquired."
|
|
|
|
# Check Profile
|
|
echo "🔹 3. Verifying Profile..."
|
|
# Based on logs, /profile works
|
|
curl -s -X GET "$API_URL/profile" \
|
|
-H "Authorization: Bearer $TOKEN" > profile_response.json
|
|
|
|
if grep -q "$USERNAME" profile_response.json; then
|
|
echo " ✅ Profile Verified."
|
|
else
|
|
echo "❌ Profile Verification Failed. Response: $(cat profile_response.json)"
|
|
# Continue to playlist to see if that works
|
|
fi
|
|
|
|
echo "🔹 4. Creating Playlist (Central Action)..."
|
|
PLAYLIST_NAME="My Demo Playlist $(date +%s)"
|
|
# Change 'name' to 'title'
|
|
PLAYLIST_PAYLOAD=$(jq -n --arg name "$PLAYLIST_NAME" '{title: $name, description: "Created by automated check", is_public: true}')
|
|
|
|
curl -s -X POST "$API_URL/playlists" \
|
|
-H "Authorization: Bearer $TOKEN" \
|
|
-H "Content-Type: application/json" \
|
|
-d "$PLAYLIST_PAYLOAD" > playlist_response.json
|
|
|
|
echo " Response: $(cat playlist_response.json)"
|
|
|
|
echo "🔹 5. Verifying Persistence..."
|
|
curl -s -X GET "$API_URL/playlists" \
|
|
-H "Authorization: Bearer $TOKEN" > playlists_list.json
|
|
|
|
if grep -q "$PLAYLIST_NAME" playlists_list.json; then
|
|
echo "✅ SUCCESS: Playlist found in list. Journey Complete."
|
|
else
|
|
echo "❌ FAILURE: Playlist not found."
|
|
exit 1
|
|
fi
|
|
|
|
rm register_response.json profile_response.json playlist_response.json playlists_list.json
|