-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
(refactor): 4263 nnnnat non meteor schemas #4266
(refactor): 4263 nnnnat non meteor schemas #4266
Conversation
…ons dir, removed the meteor check and tracker from the schemas, created a new lib/comllections/schemas/index.js that imports the schemas for meteor and adds the check and tracker to the schemas
…ts collections, removed the shopIdAutoValue call from the Accounts schema
…rom the Tag schema
…hopIdAutoValue from Shipping schema
…oValue from Cart and CartItem schema
… shopIdAutoValue from the Products schema
…Id to discounts inserts
…o taxes collection inserts
…tual schema export
…opId to data, updated usage
…n and not lazyLoad between the two options, updated shops and products schema to not use autovalues when creating slugs, updated fixtures and inserts to set slugs on shops and products
…s call to prevent an endless loop, updated importer to check the cbArgs in the process method and added jsdoc for the new arg
*/ | ||
|
||
/** | ||
* Reaction uses {@link https://github.com/aldeed/simple-schema-js SimpleSchema} to apply basic content and structure validation to Collections. |
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.
Do we need both of these jsdoc blocks?
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.
I think so, I believe @aldeed did this when he cleaned up the jsdoc a few months back
const product = { | ||
title: faker.commerce.productName(), | ||
title: productTitle, |
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.
All the other fields are being populated on the fly here, why move the productTitle into it's own const
?
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.
Nevermind... didn't see it was being used in the handle
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.
App works, able to go through the full checkout flow.
Tests pass.
Looks good!
Resolves #4263
Impact: breaking
Type: refactor
Issue
Move/change the lib/collections/schemas files so that we can get access to schemas in devserver/Jest tests without a Meteor context.
Solution
lib/collections/schemas
and intoimports/collections/schemas
meteor/check
andmeteor/Tracker
from each schema contructor.shopIdAutoValue
,shopIdAutoValueForCart
andshopDefaultCountry
autoValue functions from schemas in favor of explicitly setting those values on collectioninsert
.lib/collections/schemas/index.js
to import the non-meteor schemas and add themeteor/check
andmeteor/Tracker
to the schema's constructor for use inside the meteor application.shopIdAutoValue
from plugin schemas and updated usage to provide ashopId
on collectioninsert
server/api/core/utils.js getSlug
method to just import transliteration by default and removed theautoValue
functions being used in schema constructors in favor of setting theslug/handle
on collection inserts./lib/collections/schema/index.js
and not the schema files.Breaking changes
The schemas have moved, we're still importing them inside the
lib/collections/schemas/index.js
to apply themeteor/check
andmeteor/Tracker
to the schemas when being used with meteor. I don't believe this is a breaking change necessarily but I wanted to outline it.Aside from
createdAtAutoValue
andupdatedAtAutoValue
we're moving away from using autoValues in the schemas in favor of providing required properties.shopIdAutoValue
,shopIdAutoValueForCart
andshopDefaultCountry
autoValue helper functions will no longer be available.If you have custom plugins that are inserting into any collection that has a
shopId
property, and you rely onshopId
being automatically set, you will now have to explicitly set it yourself in the inserted object.Testing
You may need to rebuild your docker image for this branch to work