36 lines
1.1 KiB
Bash
Executable file
36 lines
1.1 KiB
Bash
Executable file
#!/bin/bash
|
|
# Legt die inquiries-Collection für Kontaktanfragen an
|
|
|
|
set -euo pipefail
|
|
PB_URL="${PB_URL:-https://api.checkflo.de}"
|
|
|
|
if [ -z "${PB_EMAIL:-}" ] || [ -z "${PB_PASSWORD:-}" ]; then
|
|
echo "Aufruf: PB_EMAIL=... PB_PASSWORD=... ./setup-inquiries.sh"; exit 1
|
|
fi
|
|
|
|
TOKEN=$(curl -sf -X POST "$PB_URL/api/collections/_superusers/auth-with-password" \
|
|
-H "Content-Type: application/json" \
|
|
-d "{\"identity\":\"$PB_EMAIL\",\"password\":\"$PB_PASSWORD\"}" | jq -r '.token')
|
|
|
|
curl -sf -X POST "$PB_URL/api/collections" \
|
|
-H "Authorization: $TOKEN" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{
|
|
"name": "inquiries",
|
|
"type": "base",
|
|
"fields": [
|
|
{"name": "name", "type": "text", "required": true},
|
|
{"name": "company", "type": "text"},
|
|
{"name": "email", "type": "email", "required": true},
|
|
{"name": "phone", "type": "text"},
|
|
{"name": "message", "type": "text"},
|
|
{"name": "plan", "type": "text"}
|
|
],
|
|
"listRule": null,
|
|
"viewRule": null,
|
|
"createRule": "",
|
|
"updateRule": null,
|
|
"deleteRule": null
|
|
}' | jq .name
|
|
|
|
echo "✓ inquiries Collection angelegt"
|