diff options
Diffstat (limited to 'official-site/add-event.sh')
| m--------- | official-site | 0 | ||||
| -rwxr-xr-x | official-site/add-event.sh | 47 |
2 files changed, 0 insertions, 47 deletions
diff --git a/official-site b/official-site new file mode 160000 +Subproject bb6b424e91001ba6f9309162af90613a0229929 diff --git a/official-site/add-event.sh b/official-site/add-event.sh deleted file mode 100755 index 109c2c8..0000000 --- a/official-site/add-event.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env bash -# Usage: bash add-event.sh <json-file> -# The JSON file should match the Event schema (see CLAUDE.md). -# id, createdAt, updatedAt, _version, _deleted, _lastChangedAt are auto-managed. -set -euo pipefail - -REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)" -[ -f "$REPO_ROOT/.env" ] && set -a && source "$REPO_ROOT/.env" && set +a - -ENDPOINT="${APP_SYNC_ENDPOINT:?APP_SYNC_ENDPOINT not set}" -API_KEY="${APP_SYNC_API_KEY:?APP_SYNC_API_KEY not set}" - -JSON_FILE="${1:-}" -if [ -z "$JSON_FILE" ]; then - echo "Usage: $0 <event-json-file>" - exit 1 -fi - -INPUT=$(python3 -c " -import json, sys -with open('$JSON_FILE') as f: - data = json.load(f) -# Remove read-only / auto-managed fields -for k in ['id', 'createdAt', 'updatedAt', '_version', '_deleted', '_lastChangedAt', '_note']: - data.pop(k, None) -# Remove null fields (optional) -data = {k: v for k, v in data.items() if v is not None} -print(json.dumps(data)) -") - -QUERY='mutation CreateEvent($input: CreateEventInput!) { createEvent(input: $input) { id type date title venueName published } }' -PAYLOAD=$(python3 -c " -import json, sys -q = '$QUERY' -inp = $INPUT -print(json.dumps({'query': q, 'variables': {'input': inp}})) -") - -echo "Creating event from $JSON_FILE ..." -RESULT=$(curl -s -X POST "$ENDPOINT" \ - -H "Content-Type: application/json" \ - -H "x-api-key: $API_KEY" \ - -d "$PAYLOAD") - -echo "$RESULT" | python3 -m json.tool -echo "" -echo "Done. Run 'bash deploy.sh' to rebuild the site." |
