-
Notifications
You must be signed in to change notification settings - Fork 2
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
[FEC-88] Migrating test data model Inventory Entry #703
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 8ea98a2 The changes in this PR will be included in the next version bump. This PR includes changesets to release 47 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
I wasn't sure if this PR was also supposed to delete the two unneeded files or if that would come later? |
__typename: 'InventoryEntry', | ||
supplyChannelRef: fake((f) => f.string.uuid()), | ||
}, | ||
postBuild: (model) => { |
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.
Not 100% sure if I did this part correctly?
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.
Looks good to me 👍
models/inventory-entry/src/types.ts
Outdated
@@ -7,6 +7,9 @@ import type { TReferenceGraphql } from '@commercetools-test-data/commons'; | |||
import type { TBuilder } from '@commercetools-test-data/core'; | |||
|
|||
// Default | |||
/** | |||
* @deprecated use `TInventoryEntryRest` instead | |||
*/ | |||
export type TInventoryEntry = Omit<InventoryEntry, 'supplyChannel'> & { | |||
supplyChannel: Channel; | |||
}; |
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.
For this PR do I need to do anything about the InventoryEntryDraft
? I didn't see anything about that in the docs.
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.
Yes, we need to migrate that model as well.
models/inventory-entry/src/index.ts
Outdated
/** | ||
* @deprecated Use `InventoryEntryRest` or `InventoryEntryGraphql` exported models instead of `InventoryEntry`. | ||
*/ | ||
export const deprecatedInventoryEntry = { |
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.
Originally I had this looking like the doc example but I was getting this error when trying to commit:
models/inventory-entry/src/index.ts:8:1
✖ 8:1 Multiple exports of name random. import/export
✖ 8:1 Multiple exports of name presets. import/export
✖ 26:14 Multiple exports of name random. import/export
✖ 27:14 Multiple exports of name presets. import/export
So I changed it to this and that made it happier. Let me know if that's not correct though.
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 that was because the deraft model has not been migrated yet.
__typename: 'InventoryEntry', | ||
supplyChannelRef: fake((f) => f.string.uuid()), | ||
}, | ||
postBuild: (model) => { |
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.
Looks good to me 👍
@@ -1,3 +1,29 @@ | |||
const presets = {}; | |||
import type { TBuilder } from '@commercetools-test-data/core'; |
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.
The index file of presets should export just plain objects with the presets for each representation.
In this case, we don't have any presets implemented for this model, so it would be something like this:
export const restPresets = {};
export const graphqlPresets = {};
Co-authored-by: Carlos Cortizas <[email protected]>
// export { default as random } from './builder'; | ||
// export { default as presets } from './presets'; |
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 can remove this commented code
CompatInventoryEntryModelBuilder, | ||
} from './builders'; | ||
import * as modelPresets from './presets'; | ||
|
||
export * as InventoryEntryDraft from './inventory-entry-draft'; |
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 need to export the three models with heir own names:
export * as InventoryEntryDraft from './inventory-entry-draft'; | |
export * from './inventory-entry-draft'; |
@jmcreasman We still need to refactor the sample data presets. I think it would be helpful to have a meeting to clarify this point. |
@CarlosCortizasCT - Yes I generated it from the test data generation repo and added it in, but then realized the data it generated wasn't in the new format/implementation even when I made it |
As part of the new test data models implementation patterns, we not only will be using it for new data models but we also need to apply it for existing ones. That means we will need to eventually migrate all the current data models those new implementation patterns.
We already have documentation about how this process looks like but we also need to have a reference example engineers can use to compare. That's what this PR is for using the InventoryEntry data model.