From 0a93e589d9f61a9cf65a7d2d8f2026dd5f48e048 Mon Sep 17 00:00:00 2001 From: Caleb Hill Date: Mon, 9 Dec 2024 12:33:10 -0700 Subject: [PATCH] wrap id in shopify gid url for ease of use this just makes it easier to call from the frontend with the .sku property --- server/src/shopify/inventory.ts | 2 +- shared/src/model/inventory.model.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/server/src/shopify/inventory.ts b/server/src/shopify/inventory.ts index e8af1d4..ea3d4ff 100644 --- a/server/src/shopify/inventory.ts +++ b/server/src/shopify/inventory.ts @@ -111,7 +111,7 @@ export async function getProductInventoryLocation ( productId: string ): Promise { const { data, errors } = await client.request(getProductLocationsQuery, { - id: productId + id: `gid://shopify/Product/${productId}` }) as { data: Record, errors: unknown } if (errors != null) { diff --git a/shared/src/model/inventory.model.ts b/shared/src/model/inventory.model.ts index 9932b7d..4d28511 100644 --- a/shared/src/model/inventory.model.ts +++ b/shared/src/model/inventory.model.ts @@ -19,6 +19,7 @@ export const VariantInventoryItemSchema = Type.Object({ export type VariantInventoryItem = Static export const UpdateInventoryRequestSchema = Type.Object({ + // This productId is in the form of a raw number(as a string) like 7507889357006, not wrapped in a shopify gid url productId: Type.Optional(Type.String()), variantId: Type.Optional(Type.String()), locationId: Type.Optional(Type.String()),