summaryrefslogtreecommitdiff
path: root/official-site
diff options
context:
space:
mode:
Diffstat (limited to 'official-site')
-rwxr-xr-xofficial-site/add-event.sh47
-rwxr-xr-xofficial-site/deploy.sh41
-rw-r--r--official-site/events/2026-06-27-cre4m-sod4.json17
-rwxr-xr-xofficial-site/list-events.sh25
4 files changed, 130 insertions, 0 deletions
diff --git a/official-site/add-event.sh b/official-site/add-event.sh
new file mode 100755
index 0000000..52c2d95
--- /dev/null
+++ b/official-site/add-event.sh
@@ -0,0 +1,47 @@
+#!/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="https://APP_SYNC_ENDPOINT_REDACTED/graphql"
+API_KEY="${APP_SYNC_API_KEY:-APP_SYNC_API_KEY_REDACTED}"
+
+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."
diff --git a/official-site/deploy.sh b/official-site/deploy.sh
new file mode 100755
index 0000000..32574e0
--- /dev/null
+++ b/official-site/deploy.sh
@@ -0,0 +1,41 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
+[ -f "$REPO_ROOT/.env" ] && set -a && source "$REPO_ROOT/.env" && set +a
+
+AWS_CLI="${AWS_CLI:-/tmp/awscli/aws/dist/aws}"
+APP_ID="d33773t2lyrxkx"
+BRANCH="main"
+REGION="${AWS_DEFAULT_REGION:-ap-northeast-1}"
+
+echo "Starting Amplify build: app=$APP_ID branch=$BRANCH"
+JOB=$("$AWS_CLI" amplify start-job \
+ --app-id "$APP_ID" \
+ --branch-name "$BRANCH" \
+ --job-type RELEASE \
+ --region "$REGION" \
+ --output json)
+
+JOB_ID=$(echo "$JOB" | python3 -c "import json,sys; print(json.load(sys.stdin)['jobSummary']['jobId'])")
+echo "Job started: $JOB_ID"
+echo "Console: https://ap-northeast-1.console.aws.amazon.com/amplify/apps/$APP_ID/branches/$BRANCH/deployments/$JOB_ID"
+
+echo "Waiting for build to complete..."
+while true; do
+ STATUS=$("$AWS_CLI" amplify get-job \
+ --app-id "$APP_ID" \
+ --branch-name "$BRANCH" \
+ --job-id "$JOB_ID" \
+ --region "$REGION" \
+ --output json | python3 -c "import json,sys; print(json.load(sys.stdin)['job']['summary']['status'])")
+ echo " Status: $STATUS"
+ if [[ "$STATUS" == "SUCCEED" ]]; then
+ echo "Build succeeded! https://www.mosquit.one"
+ break
+ elif [[ "$STATUS" == "FAILED" || "$STATUS" == "CANCELLED" ]]; then
+ echo "Build $STATUS"
+ exit 1
+ fi
+ sleep 15
+done
diff --git a/official-site/events/2026-06-27-cre4m-sod4.json b/official-site/events/2026-06-27-cre4m-sod4.json
new file mode 100644
index 0000000..89ce98a
--- /dev/null
+++ b/official-site/events/2026-06-27-cre4m-sod4.json
@@ -0,0 +1,17 @@
+{
+ "id": "4c99e242-c13d-404b-92a9-4c2cd59ad68a",
+ "type": "LIVE",
+ "date": "2026-06-27",
+ "title": "cre4m sod4",
+ "shortTitle": "cre4m sod4",
+ "venueName": "navey floor AKASAKA",
+ "published": true,
+ "description": "雨傘とペトリコール / mosquitone / 人造ネオン / LOOM",
+ "ticketFee": "一般 ¥3,000(+1D ¥700) ※学生証提示で¥1,000ディスカウント / 配信 ¥2,000",
+ "key": "260627",
+ "ticketURL": null,
+ "detailURL": null,
+ "mainImageURL": null,
+ "venueURL": null,
+ "_note": "OPEN 18:30 / START 19:00"
+}
diff --git a/official-site/list-events.sh b/official-site/list-events.sh
new file mode 100755
index 0000000..0093875
--- /dev/null
+++ b/official-site/list-events.sh
@@ -0,0 +1,25 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
+[ -f "$REPO_ROOT/.env" ] && set -a && source "$REPO_ROOT/.env" && set +a
+
+AWS_CLI="${AWS_CLI:-/tmp/awscli/aws/dist/aws}"
+ENDPOINT="https://APP_SYNC_ENDPOINT_REDACTED/graphql"
+API_KEY="${APP_SYNC_API_KEY:-APP_SYNC_API_KEY_REDACTED}"
+
+QUERY='{ listEvents(limit: 200) { items { id type date title venueName published shortTitle ticketFee key } } }'
+
+curl -s -X POST "$ENDPOINT" \
+ -H "Content-Type: application/json" \
+ -H "x-api-key: $API_KEY" \
+ -d "{\"query\": $(echo "$QUERY" | python3 -c 'import json,sys; print(json.dumps(sys.stdin.read()))')}" \
+| python3 -c "
+import json, sys
+d = json.load(sys.stdin)
+items = d['data']['listEvents']['items']
+items.sort(key=lambda x: x['date'] or '')
+for e in items:
+ pub = '✓' if e['published'] else ' '
+ print(f\"[{pub}] {e['date']} {e['title'][:50]:<50} {e['venueName'] or ''}\")
+"