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