M
Manifest2mo ago
Khoa

Is this an acceptable way to have one product contains multiple images?

Product:
properties:
- name
- { name: category, type: string }
- { name: description, type: string }
belongsToMany:
- ProductImage

ProductImage:
properties:
- { name: path, type: string }
Product:
properties:
- name
- { name: category, type: string }
- { name: description, type: string }
belongsToMany:
- ProductImage

ProductImage:
properties:
- { name: path, type: string }
3 Replies
Khoa
KhoaOP2mo ago
I was working on a simple ecommerce website
brunobuddy
brunobuddy2mo ago
Yes, it is great ! The Category also can be a relation instead of a property if you want to be able to filter products by Category with ease:
Product:
properties:
- name
- { name: category, type: string }
- { name: description, type: string }
belongsToMany:
- ProductImage
belongsTo:
- Category

Category:
properties:
- name

ProductImage:
properties:
- { name: path, type: string }
Product:
properties:
- name
- { name: category, type: string }
- { name: description, type: string }
belongsToMany:
- ProductImage
belongsTo:
- Category

Category:
properties:
- name

ProductImage:
properties:
- { name: path, type: string }
Khoa
KhoaOP2mo ago
oh ok. thank you very much.

Did you find this page helpful?