-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(cms): Add Product API to CMS #159
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might want to consider how the business team/users will be using this website in our schemas. LGTM otherwise!
name: "colors", | ||
type: "select", | ||
hasMany: true, | ||
options: [ | ||
{ | ||
label: "Black", | ||
value: "black", | ||
}, | ||
{ | ||
label: "White", | ||
value: "white", | ||
}, | ||
{ | ||
label: "Blue", | ||
value: "blue", | ||
}, | ||
], | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might make more sense for the type to be "text" with hasMany
so we allow the business team to add colours as necessary. The same applies to sizes
, category
and stock
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are on Payload CMS 1.8.3, which does not have hasMany
on the text
.
Three options:
- Upgrade Payload CMS to >2.0, potentially having to stomach breaking changes / large rewrites in the port.
- Add a
colors
,sizes
,category
&stock
collections which can be amended dynamically by the business team and then use therelationship
type from theproduct
collection to link to color, sizes etc. However, this normalises the data model which is contradicts the purpose of using a document data model in MongoDB in the first place: colocating data accessed together. Normalisation is more suitable to the generic SQL relational DBs like PostgreSQL. - Do nothing, consider this a premature optimization: one can quickly add options if necessary.
d0f993d
to
76cd993
Compare
Deployment preview link: https://website-l2aesxpo1-cse-it.vercel.app |
Motivation
See card
Contents
Implements Product API in CMS with the following product schema:
package/types/lib/merch.ts
due to Payload limitations.Demo: Download & import Postman API collection