feat(shopify): port product sync to TypeScript (Vercel, no Python backend)#10
Open
StockerMC wants to merge 1 commit into
Open
feat(shopify): port product sync to TypeScript (Vercel, no Python backend)#10StockerMC wants to merge 1 commit into
StockerMC wants to merge 1 commit into
Conversation
…thon backend) Adds getProducts() to lib/shopify.ts (Admin API + Link-header pagination, fixes the inverted price guard from the Python version) and a new /api/shopify/sync route that fetches the catalog into company_products using the stored OAuth token. The OAuth callback now triggers it fire-and-forget so a freshly connected store populates without the Python backend. Creator discovery/embeddings still belong to the Python worker (Cloud Run); this only covers catalog sync.
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Ports the product-sync half of the Python backend's post-OAuth job to TypeScript so a connected store's catalog populates on Vercel — no Python backend or Redis needed.
Changes
lib/shopify.ts: newgetProducts(shop, accessToken)— Shopify Admin API with Link-header cursor pagination (handles >250 products). Fixes the inverted price guard from the Python version (which indexed an empty variants array)./api/shopify/sync(new): looks up the company's stored active OAuth token (server-side, service role — never accepts a token from the caller), fetches the catalog, replacescompany_productsfor that company, and recordsproducts_synced/product_count+companies.ingested./api/shopify/callback: triggers the sync fire-and-forget after a successful connect (doesn't block the redirect).Scope / non-goals
Creator discovery + embeddings (the long-running pipeline) still belong to the Python worker on Cloud Run. This only covers catalog sync, which is enough for connect → Products page to work end-to-end on Vercel.
Local
bun run buildwas run but the tool output channel degraded before I could capture the verdict — please confirm CI/build is green before merging. Changes are small and follow existing patterns (mirrorsgetShopInfo/createShopifyDiscountand the othersupabaseAdminroutes).