feat: enforce SKU validity, use SKU as handle
This commit enforces proper SKU validation, uses the SKU as the Shopify handle, and implements ID-based product updates to allow renaming. It also extracts the IShop interface for TDD.
This commit is contained in:
13
src/interfaces/IShop.ts
Normal file
13
src/interfaces/IShop.ts
Normal file
@ -0,0 +1,13 @@
|
||||
import * as shopify from "shopify-admin-api-typings";
|
||||
import { Config } from "../config";
|
||||
|
||||
export interface IShop {
|
||||
GetProductBySku(sku: string): any; // Return type is inferred as product node
|
||||
GetProductById(id: string): any; // New method
|
||||
GetInventoryItemBySku(sku: string): shopify.InventoryItem;
|
||||
UpdateInventoryItemQuantity(item: shopify.InventoryItem, delta: number, config: Config): shopify.InventoryItem;
|
||||
SetInventoryItemQuantity(item: shopify.InventoryItem, quantity: number, config: Config): any;
|
||||
SetInventoryItemDefaults(item: shopify.InventoryItem, config: Config): shopify.InventoryItem;
|
||||
SetInventoryItemWeight(item: shopify.InventoryItem, config: Config, weight: number, weight_unit: shopify.WeightUnit): shopify.InventoryItem;
|
||||
shopifyGraphQLAPI(payload: any): any;
|
||||
}
|
||||
Reference in New Issue
Block a user