-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add aggregate inventory data to product api
- Loading branch information
1 parent
f90d994
commit 085a4c3
Showing
5 changed files
with
79 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,8 @@ | ||
import {Static, Type} from "@fastify/type-provider-typebox"; | ||
|
||
export const VariantInventorySchema = Type.Object({ | ||
export const InventorySchema = Type.Object({ | ||
totalInventory: Type.Integer(), | ||
totalCommittedInventory: Type.Integer(), | ||
totalAvailableInventory: Type.Integer(), | ||
inventoryItem: Type.Object({ | ||
inventoryLevels: Type.Null() // TODO | ||
}) | ||
totalAvailableInventory: Type.Integer() | ||
}) | ||
export type VariantInventory = Static<typeof VariantInventorySchema> | ||
export type Inventory = Static<typeof InventorySchema> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
import { Static, Type } from '@fastify/type-provider-typebox' | ||
import { ImageObjSchema } from './image.model' | ||
import { Nullable } from './misc' | ||
import {VariantInventorySchema} from "./inventory.model"; | ||
import {InventorySchema} from "./inventory.model"; | ||
|
||
export const VariantSchema = Type.Object({ | ||
id: Type.String(), | ||
title: Type.String(), | ||
image: Nullable(ImageObjSchema), // TODO: Should this be optional? | ||
image: Nullable(ImageObjSchema), | ||
contextualPricing: Type.Object({ | ||
price: Type.Object({ | ||
amount: Type.String(), | ||
currencyCode: Type.String() | ||
}) | ||
}), | ||
sku: Nullable(Type.String()), | ||
inventory: VariantInventorySchema | ||
inventory: InventorySchema | ||
}) | ||
export type Variant = Static<typeof VariantSchema> | ||
|