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(test-data): create StandalonePrice model and associated draft #472

Merged
merged 6 commits into from
Feb 6, 2024

Conversation

jaikamat
Copy link
Contributor

@jaikamat jaikamat commented Feb 2, 2024

Summary

This PR creates the StandalonePrice model and associated draft for use with our B2B dataset support effort.

Standalone prices REST documentation

Graphql structure:
Base model:
image
Draft model:
image

@jaikamat jaikamat self-assigned this Feb 2, 2024
@jaikamat jaikamat requested review from a team as code owners February 2, 2024 15:59
@jaikamat jaikamat requested review from Sarah4VT, jmcreasman, kterry1 and valoriecarli and removed request for a team February 2, 2024 15:59
Copy link

changeset-bot bot commented Feb 2, 2024

🦋 Changeset detected

Latest commit: 4b60553

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

This PR includes changesets to release 34 packages
Name Type
@commercetools-test-data/standalone-price Minor
@commercetools-test-data/commons Minor
@commercetools-test-data/graphql-types 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-object 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/quote 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/state Minor
@commercetools-test-data/store Minor
@commercetools-test-data/tax-category Minor
@commercetools-test-data/type Minor
@commercetools-test-data/zone Minor
@commercetools-test-data/core 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

): TReferenceGraphql<'customer-group'>;

// Create a customer group reference depending on `id` or `key` field availability
function createCustomerGroupReference(
Copy link
Contributor Author

@jaikamat jaikamat Feb 2, 2024

Choose a reason for hiding this comment

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

key is optional in CustomerGroup - I wanted consumers to get the type of reference they intended, so I opted to create a KeyReference if key was provided, otherwise create an id Reference (rather than defaulting to an id Reference)

Comment on lines +33 to +34
discounted: null,
staged: null,
Copy link
Contributor Author

@jaikamat jaikamat Feb 2, 2024

Choose a reason for hiding this comment

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

Both of these models (DiscountedPrice and StagedStandalonePrice) are not necessary for our effort and were omitted from creation, in the interest of time

Comment on lines +72 to +73
// Remove `expiresAt` from the fields
const { expiresAt, ...rest } = fields;
Copy link
Contributor

Choose a reason for hiding this comment

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

sheer curiosity: do we know why these two representations deviate with this field?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope!

Copy link
Contributor

@tylermorrisford tylermorrisford left a comment

Choose a reason for hiding this comment

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

LGTM! Your types.ts files are always literal art 🧑‍🎨 🔥

Copy link
Contributor

@tdeekens tdeekens left a comment

Choose a reason for hiding this comment

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

Code looks good. Maybe an unknown piece but there are models inside the priceless repo.

models/standalone-price/src/index.ts Outdated Show resolved Hide resolved
models/standalone-price/src/transformers.ts Show resolved Hide resolved
models/standalone-price/src/types.ts Outdated Show resolved Hide resolved
@ragafus
Copy link
Contributor

ragafus commented Feb 5, 2024

Code looks good. Maybe an unknown piece but there are models inside the priceless repo.

In the long run, our idea is to replace those linked models with @commercetools-test-data/standalone-price.
Thanks a ton @jaikamat!

@jaikamat jaikamat requested a review from ragafus February 5, 2024 18:58
@jaikamat jaikamat merged commit f027639 into main Feb 6, 2024
3 checks passed
@jaikamat jaikamat deleted the FCT-677 branch February 6, 2024 11:52
@ct-changesets ct-changesets bot mentioned this pull request Feb 6, 2024
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.

4 participants