Skip to content

Commit

Permalink
refactor(inventory-entry): supply channel is optional
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlosCortizasCT committed Dec 5, 2024
1 parent 40ea8ce commit 69dba8b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 2 additions & 4 deletions models/inventory-entry/src/fields-config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { ChannelGraphql } from '@commercetools-test-data/channel';
import {
ClientLogging,
Reference,
Expand Down Expand Up @@ -27,20 +26,19 @@ const commonFieldsConfig = {
availableQuantity: fake((f) => f.number.int()),
restockableInDays: fake((f) => f.number.int()),
expectedDelivery: fake(getFutureDate),
supplyChannel: null,
custom: null,
};
export const restFieldsConfig: TModelFieldsConfig<TInventoryEntryRest> = {
fields: {
...commonFieldsConfig,
supplyChannel: fake(() => Reference.presets.channelReference()),
},
};
export const graphqlFieldsConfig: TModelFieldsConfig<TInventoryEntryGraphql> = {
fields: {
...commonFieldsConfig,
__typename: 'InventoryEntry',
supplyChannel: fake(() => ChannelGraphql.random()),
supplyChannelRef: fake((f) => Reference.presets.channelReference()),
supplyChannelRef: null,
},
postBuild: (model) => {
const supplyChannelRef = model.supplyChannel
Expand Down
3 changes: 3 additions & 0 deletions models/inventory-entry/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ import type {
* @deprecated use `TInventoryEntryRest` instead
*/
export type TInventoryEntry = InventoryEntry;
/**
* @deprecated use `TInventoryEntryDraftRest` instead
*/
export type TInventoryEntryDraft = InventoryEntryDraft;

// REST
Expand Down

0 comments on commit 69dba8b

Please sign in to comment.