Skip to content

Commit

Permalink
fix(product): TProductGraphql and TProductCatalogDataGraphql types (
Browse files Browse the repository at this point in the history
#752)

* fix(product): wrong `TProductGraphql` and `TProductCatalogDataGraphql` types

* chore: add changeset
  • Loading branch information
ragafus authored Feb 12, 2025
1 parent a445a19 commit 98102ed
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 30 deletions.
5 changes: 5 additions & 0 deletions .changeset/nine-buses-smile.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@commercetools-test-data/product': patch
---

Fix `TProductCatalogDataGraphql`, `TProductGraphql`, `TProductDraftGraphql` types
1 change: 1 addition & 0 deletions models/product/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"@commercetools-test-data/channel": "10.12.0",
"@commercetools-test-data/commons": "10.12.0",
"@commercetools-test-data/core": "10.12.0",
"@commercetools-test-data/graphql-types": "10.12.0",
"@commercetools-test-data/product-type": "10.12.0",
"@commercetools-test-data/tax-category": "10.12.0",
"@commercetools-test-data/utils": "10.12.0",
Expand Down
5 changes: 2 additions & 3 deletions models/product/src/product-catalog-data/types.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { ProductCatalogData } from '@commercetools/platform-sdk';
import type { TBuilder } from '@commercetools-test-data/core';
import type { TCtpProductCatalogData } from '@commercetools-test-data/graphql-types';

export type TProductCatalogData = ProductCatalogData;

export type TProductCatalogDataGraphql = TProductCatalogData & {
__typename: 'ProductCatalogData';
};
export type TProductCatalogDataGraphql = TCtpProductCatalogData;

export type TProductCatalogDataBuilder = TBuilder<TProductCatalogData>;
export type TCreateProductCatalogDataBuilder = () => TProductCatalogDataBuilder;
33 changes: 6 additions & 27 deletions models/product/src/product/types.ts
Original file line number Diff line number Diff line change
@@ -1,41 +1,20 @@
import { Product, ProductDraft } from '@commercetools/platform-sdk';
import {
TLocalizedStringDraftGraphql,
TReferenceGraphql,
} from '@commercetools-test-data/commons';
import type { TBuilder } from '@commercetools-test-data/core';
import {
TCtpProduct,
TCtpProductDraft,
} from '@commercetools-test-data/graphql-types';

export type TProduct = Product & {
skus: Array<String>;
};

export type TProductRest = Omit<TProduct, 'skus'>;

export type TProductGraphql = TProduct & {
productTypeRef: TReferenceGraphql;
stateRef: TReferenceGraphql;
taxCategoryRef: TReferenceGraphql;
// TODO: add productSelectionRefs
__typename: 'Product';
};
export type TProductGraphql = TCtpProduct;

export type TProductDraft = ProductDraft;
export type TProductDraftGraphql = Omit<
TProductDraft,
| 'name'
| 'description'
| 'slug'
| 'metaTitle'
| 'metaDescription'
| 'metaKeywords'
> & {
name: TLocalizedStringDraftGraphql;
slug: TLocalizedStringDraftGraphql;
description?: TLocalizedStringDraftGraphql | null;
metaTitle?: TLocalizedStringDraftGraphql | null;
metaDescription?: TLocalizedStringDraftGraphql | null;
metaKeywords?: TLocalizedStringDraftGraphql | null;
};
export type TProductDraftGraphql = TCtpProductDraft;

export type TProductBuilder = TBuilder<TProduct>;
export type TCreateProductBuilder = () => TProductBuilder;
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 98102ed

Please sign in to comment.