-
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
chore(business-unit): graphql transformers for Company and Division models #439
Conversation
🦋 Changeset detectedLatest commit: fbc0ab4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 32 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 |
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.
Would we want a test for the new graphql transformers?
good catch! I will add some |
replaceFields: ({ fields }) => ({ | ||
...fields, | ||
topLevelUnit: { | ||
...fields, |
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 this may just need typeId: 'business-unit'
but I am not yet certain as to why 😿
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'm finding some other fields that may be missing from the graphql representation and should be added to the transformer: parentUnitRef
, topLevelUnitRef
, storesRef
.
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.
You're completely right, I missed those! I'll add them to the transformer and the tests
This is looking good! Do you think it would make sense to create different types for company and division? I'm wondering if that would allow for better typing, or if it would not accomplish much. I will try and get you some more eyes on this 🙏 |
Afaik the only difference is the parent unit / ref always being null/undefined for the parent unit and the unitType being Company or Division accordingly, so we would get a type that's a bit stricter for those properties and there are already Company and Division types from the SDK to use as the base. I think it's a good idea. |
6d70521
to
9561d11
Compare
@tylermorrisford / @ChristianMoll I really like this and went back and forth on this issue it when I first built this. If we move forward with breaking it out, we should do the same for |
I agree. Reduce the potential smell. |
export type TCompanyDraftGraphql = TCompanyDraft & { | ||
__typename: 'BusinessUnitDraft'; | ||
}; | ||
export type TDivisionDraftGraphql = TDivisionDraft & { | ||
__typename: 'BusinessUnitDraft'; | ||
}; |
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.
Love this - thank you for all this work!
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.
@ChristianMoll Thank you so much for adding these much needed improvements to our initial round 💯
@valoriecarli @tylermorrisford |
This PR aims to replace the current scaffolding in the Company and Division models with the real implementation.