MediaImage (table media_image) to avoid colliding with Medusa’s product Image model.
Data models
MediaImage
Table media_image, ID prefix medimg.
| Field | Type | Notes |
|---|---|---|
url | text | |
type | text | Nullable; "icon" for icons, null for gallery images |
is_thumbnail | boolean | Default false |
is_banner | boolean | Default false |
rank | number | Default 0; gallery ordering |
metadata | json | Nullable |
Links
| Link | Alias | Purpose |
|---|---|---|
Product.productCategory ↔ MediaImage | media_images | Category gallery + icon |
Product.productCollection ↔ MediaImage | media_images | Collection gallery + icon |
Invariants
The service is plain CRUD; the invariants are enforced by thesetCategoryImagesWorkflow / setCollectionImagesWorkflow:
- At most one thumbnail, one banner, and one icon per entity.
- The same image may be both thumbnail and banner.
- Setting
icon: nullclears the icon; deleting the entity removes its linked images (no orphans).
createProductCollectionWithImagesWorkflow, etc.) that combine Medusa’s core workflow with the image-set step.
Related endpoints
GET/POST/DELETE /admin/collections[/:id]— acceptmedia[](with thumbnail/banner designations) andiconin the body; responses include the linkedimages.- Admin product-category routes accept the same shape.
- Vendor collection and category routes expose the images read-only.