Skip to content
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(associate-role): create associate role package and model #435

Merged
merged 2 commits into from
Nov 22, 2023

Conversation

ChristianMoll
Copy link
Contributor

Adds the associate role package and model
I tried my best to make it fit the standards of the other models but as this is my first contribution I look forward to your feedback 🙇

Copy link

changeset-bot bot commented Nov 21, 2023

🦋 Changeset detected

Latest commit: 77960b4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 29 packages
Name Type
@commercetools-test-data/commons Minor
@commercetools-test-data/associate-role Minor
@commercetools-test-data/business-unit Minor
@commercetools-test-data/cart-discount Minor
@commercetools-test-data/cart Minor
@commercetools-test-data/category Minor
@commercetools-test-data/channel Minor
@commercetools-test-data/custom-view Minor
@commercetools-test-data/customer-group Minor
@commercetools-test-data/customer Minor
@commercetools-test-data/discount-code Minor
@commercetools-test-data/inventory-entry Minor
@commercetools-test-data/order Minor
@commercetools-test-data/payment Minor
@commercetools-test-data/product-discount Minor
@commercetools-test-data/product-selection Minor
@commercetools-test-data/product-type Minor
@commercetools-test-data/product Minor
@commercetools-test-data/quote-request Minor
@commercetools-test-data/review Minor
@commercetools-test-data/shipping-method Minor
@commercetools-test-data/shopping-list Minor
@commercetools-test-data/staged-quote Minor
@commercetools-test-data/store Minor
@commercetools-test-data/tax-category Minor
@commercetools-test-data/zone Minor
@commercetools-test-data/core Minor
@commercetools-test-data/graphql-types Minor
@commercetools-test-data/utils Minor

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

@@ -0,0 +1,28 @@
{
"name": "@commercetools-test-data/associate-role",
"version": "6.4.2",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"version": "6.4.2",
"version": "6.5.0",

Comment on lines +4 to +12
const generator = Generator<TAssociateRoleDraft>({
fields: {
key: fake((f) => f.string.alphanumeric(10)),
name: fake((f) => f.string.alphanumeric(15)),
buyerAssignable: fake((f) => f.datatype.boolean()),
permissions: [],
custom: null,
},
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we're missing a draft transformer?


export { default as random } from './builder';
export * as presets from './presets';
export { default as draftPresets } from './associate-role-draft/presets';
Copy link
Contributor

@valoriecarli valoriecarli Nov 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if line6 is needed?
Also, just wanted to check to see if your presets should be under the draft preset folder (as opposed to the final where they are currently located)?
There is no hard rule on the location, it is only a pattern we have been using.

Screenshot 2023-11-22 at 09 26 02

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case we felt that having them for the final was probably more useful but I am totally open to changing it later

Comment on lines 10 to 20
id: fake((f) => f.string.uuid()),
version: sequence(),
createdAt: fake(getOlderDate),
createdBy: fake(() => ClientLogging.random()),
lastModifiedAt: fake(getNewerDate),
lastModifiedBy: fake(() => ClientLogging.random()),
key: fake((f) => f.string.alphanumeric(10)),
name: fake((f) => f.string.alphanumeric(15)),
buyerAssignable: fake((f) => f.datatype.boolean()),
permissions: [],
custom: null,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
id: fake((f) => f.string.uuid()),
version: sequence(),
createdAt: fake(getOlderDate),
createdBy: fake(() => ClientLogging.random()),
lastModifiedAt: fake(getNewerDate),
lastModifiedBy: fake(() => ClientLogging.random()),
key: fake((f) => f.string.alphanumeric(10)),
name: fake((f) => f.string.alphanumeric(15)),
buyerAssignable: fake((f) => f.datatype.boolean()),
permissions: [],
custom: null,
id: fake((f) => f.string.uuid()),
version: sequence(),
key: fake((f) => f.string.alphanumeric(10)),
buyerAssignable: fake((f) => f.datatype.boolean()),
name: fake((f) => f.string.alphanumeric(15)),
permissions: [],
custom: null,
createdAt: fake(getOlderDate),
createdBy: fake(() => ClientLogging.random()),
lastModifiedAt: fake(getNewerDate),
lastModifiedBy: fake(() => ClientLogging.random()),

Absolutely nothing wrong with the way you had it, it's just easier to keep in the same order as the docs...trust me.

@valoriecarli valoriecarli self-requested a review November 22, 2023 15:43
Copy link
Contributor

@valoriecarli valoriecarli left a 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 your contribution! 🙌🏻
I left a few comments/suggestions, but overall you killed it.

I will go ahead and approve it, but please make sure you update the version number in the json packge. It isn't displaying any errors, but iirc, i think it will cause issues down the line?

Disclaimer-I did not go over the draft/final graphql transformation in great detail, so that shape may/may not need a little more massaging.

@ChristianMoll ChristianMoll enabled auto-merge (squash) November 22, 2023 19:35
@ChristianMoll ChristianMoll merged commit c1d6788 into main Nov 22, 2023
3 checks passed
@ChristianMoll ChristianMoll deleted the CUT-690-associate-role-package branch November 22, 2023 19:40
@ct-changesets ct-changesets bot mentioned this pull request Nov 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants