M
Manifest2w 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
KhoaOP2w ago
I was working on a simple ecommerce website
brunobuddy
brunobuddy6d 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
KhoaOP5d ago
oh ok. thank you very much.
Want results from more Discord servers?
Add your server