Sync static image slots from the live website catalog.

Refresh now imports keys from the storefront and deletes unused slots plus their files.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Alireza Hassani
2026-08-17 09:55:03 +03:30
co-authored by Cursor
parent 1c7678ce67
commit 5e5bfc4aa3
8 changed files with 474 additions and 2 deletions
+1
View File
@@ -267,6 +267,7 @@ All routes are prefixed with `/api/v1`.
| GET | `/tenants/:host/website/sliders` | Homepage sliders with slides |
| GET | `/tenants/:host/website/static-images` | Named static image slots (`?pageKey=` optional) |
| GET | `/tenants/:host/website/static-images/:key` | One static image slot by key |
| POST | `/businesses/:id/website/static-images/sync` | Import slot keys from `GET https://{domain}/meshkee/static-image-slots` |
### Authenticated (JWT)
+31
View File
@@ -54,6 +54,37 @@ Named slots the business dashboard can replace. Fetch once per page:
Use `slot.key` in the placeholder. Match `pageKey` to the website page. For a single image: `images[0]?.url`. For a list: map `images` (if `itemCount` is set, that many images are expected). Each image may include `titleFa`, `titleEn`, `subtext`, and `linkUrl`. If `linkUrl` is set, wrap in `<a href={linkUrl}>`. Pick `titleFa` or `titleEn` from the site locale. If `images` is empty, keep the local fallback.
**Also publish a slot catalog on this website** so the business dashboard Refresh button can import keys from the main domain:
`GET https://<WEBSITE_DOMAIN>/meshkee/static-image-slots`
```json
{
"slots": [
{
"key": "slider",
"label": "Homepage slider",
"kind": "list",
"pageKey": "home",
"aspectRatio": "16:9",
"itemCount": null,
"recommendedWidth": 1440
},
{
"key": "home-side-banner",
"label": "Side banner",
"kind": "single",
"pageKey": "home",
"aspectRatio": "12:19",
"itemCount": 1,
"recommendedWidth": 480
}
]
}
```
`kind` is `single` (one image) or `list` (duplicatable). For a fixed row, set `itemCount` (e.g. `2`). Leave `itemCount` null for an unbounded slider. `aspectRatio` must look like `16:9`. Do not invent CMS/upload APIs.
If OpenAPI and this brief conflict, **OpenAPI wins**.
---