docs: fixes to recipes and examples following latest update (#13933)
This commit is contained in:
@@ -426,13 +426,27 @@ If you get a type error on resolving the Algolia Module, run the Medusa applicat
|
||||
</Note>
|
||||
|
||||
```ts title="src/workflows/steps/sync-products.ts"
|
||||
import { ProductDTO } from "@medusajs/framework/types"
|
||||
import { createStep, StepResponse } from "@medusajs/framework/workflows-sdk"
|
||||
import { ALGOLIA_MODULE } from "../../modules/algolia"
|
||||
import AlgoliaModuleService from "../../modules/algolia/service"
|
||||
|
||||
export type SyncProductsStepInput = {
|
||||
products: ProductDTO[]
|
||||
products: {
|
||||
id: string
|
||||
title: string
|
||||
description?: string
|
||||
handle: string
|
||||
thumbnail?: string
|
||||
categories: {
|
||||
id: string
|
||||
name: string
|
||||
handle: string
|
||||
}[]
|
||||
tags: {
|
||||
id: string
|
||||
value: string
|
||||
}[]
|
||||
}[]
|
||||
}
|
||||
|
||||
export const syncProductsStep = createStep(
|
||||
|
||||
@@ -1431,7 +1431,7 @@ export const createProductsContentfulWorkflow = createWorkflow(
|
||||
})
|
||||
|
||||
const contentfulProducts = createProductsContentfulStep({
|
||||
products: data as ProductDTO[],
|
||||
products: data as unknown as ProductDTO[],
|
||||
})
|
||||
|
||||
return new WorkflowResponse(contentfulProducts)
|
||||
|
||||
@@ -403,13 +403,27 @@ If you get a type error on resolving the Meilisearch Module, run the Medusa appl
|
||||
</Note>
|
||||
|
||||
```ts title="src/workflows/steps/sync-products.ts"
|
||||
import { ProductDTO } from "@medusajs/framework/types"
|
||||
import { createStep, StepResponse } from "@medusajs/framework/workflows-sdk"
|
||||
import { MEILISEARCH_MODULE } from "../../modules/meilisearch"
|
||||
import MeilisearchModuleService from "../../modules/meilisearch/service"
|
||||
|
||||
export type SyncProductsStepInput = {
|
||||
products: ProductDTO[]
|
||||
products: {
|
||||
id: string
|
||||
title: string
|
||||
description?: string
|
||||
handle: string
|
||||
thumbnail?: string
|
||||
categories: {
|
||||
id: string
|
||||
name: string
|
||||
handle: string
|
||||
}[]
|
||||
tags: {
|
||||
id: string
|
||||
value: string
|
||||
}[]
|
||||
}[]
|
||||
}
|
||||
|
||||
export const syncProductsStep = createStep(
|
||||
@@ -547,6 +561,7 @@ export const syncProductsWorkflow = createWorkflow(
|
||||
products: data,
|
||||
} as SyncProductsStepInput)
|
||||
|
||||
// @ts-ignore
|
||||
return new WorkflowResponse({
|
||||
products: data,
|
||||
metadata,
|
||||
|
||||
@@ -781,7 +781,7 @@ while (hasMore) {
|
||||
products.map(async (prod) => {
|
||||
const after = await sanityModule.upsertSyncDocument(
|
||||
"product",
|
||||
prod as ProductDTO
|
||||
prod as unknown as ProductDTO
|
||||
)
|
||||
|
||||
upsertMap.push({
|
||||
|
||||
Reference in New Issue
Block a user