Social assets: no auto table create, manual SQL only

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Timo
2026-07-10 11:14:26 +02:00
parent 863e03f802
commit c26c2aae31
2 changed files with 8 additions and 17 deletions

View File

@@ -74,7 +74,11 @@
## QRMaster Social Asset Hosting (no-deploy image URLs)
- `POST https://qrmaster.net/api/social-assets` (header `x-admin-key: <TIKTOK_ADMIN_KEY>`) with JSON `{ "files": [{ "filename", "mimeType", "dataBase64" }] }` stores images in PostgreSQL and returns public `https://qrmaster.net/api/social-assets/<id>` URLs on the verified domain.
- `GET /api/social-assets/<id>` serves the file publicly (immutable cache); `GET /api/social-assets` (admin) lists the last 100 assets; `DELETE /api/social-assets/<id>` (admin) removes one.
- Allowed types: jpeg/png/webp/mp4, max 10 MB per file. Table `SocialAsset` is auto-created on first upload (`CREATE TABLE IF NOT EXISTS`, in line with the no-migrations policy).
- Allowed types: jpeg/png/webp/mp4, max 10 MB per file.
- The `SocialAsset` table must be created manually on the server (one-time, no auto-create in the route). Run on the server:
```bash
docker-compose exec db psql -U postgres -d qrmaster -c 'CREATE TABLE IF NOT EXISTS "SocialAsset" ("id" TEXT PRIMARY KEY, "filename" TEXT NOT NULL, "mimeType" TEXT NOT NULL, "data" BYTEA NOT NULL, "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP);'
```
- Typical carousel flow: upload slides here → pass the returned URLs as `photos` to `POST /api/tiktok/upload` → check via `/api/tiktok/upload/status?publish_id=...`. No app deploy needed per carousel.
## Refresh Behavior