feat: Add product export endpoint and a dummy workflow (#8178)
This commit is contained in:
1 parent
1a472733ae
commit
8d083d6d0f
11 files changed
+469
-457
No files matched your search
@@ -0,0 +1,18 @@
|
||||
import { WorkflowData, createWorkflow } from "@medusajs/workflows-sdk"
|
||||
import { useRemoteQueryStep } from "../../common"
|
||||
import { WorkflowTypes } from "@medusajs/types"
|
||||
|
||||
export const exportProductsWorkflowId = "export-products"
|
||||
export const exportProductsWorkflow = createWorkflow(
|
||||
exportProductsWorkflowId,
|
||||
(
|
||||
input: WorkflowData<WorkflowTypes.ProductWorkflow.ExportProductsDTO>
|
||||
): WorkflowData<void> => {
|
||||
const products = useRemoteQueryStep({
|
||||
entry_point: "product",
|
||||
fields: input.select,
|
||||
variables: input.filter,
|
||||
list: true,
|
||||
})
|
||||
}
|
||||
)
|
||||
@@ -20,3 +20,4 @@ export * from "./update-product-types"
|
||||
export * from "./update-product-tags"
|
||||
export * from "./update-product-variants"
|
||||
export * from "./update-products"
|
||||
export * from "./export-products"
|
||||
@@ -1,6 +1,7 @@
|
||||
import { BatchMethodRequest } from "../../../common"
|
||||
import { ProductStatus } from "../common"
|
||||
|
||||
export interface AdminExportProductRequest {}
|
||||
export interface AdminBatchProductRequest
|
||||
extends BatchMethodRequest<AdminCreateProduct, AdminUpdateProduct> {}
|
||||
|
||||
|
||||
@@ -31,6 +31,10 @@ export type AdminProductVariantListResponse = PaginatedResponse<{
|
||||
export interface AdminProductVariantDeleteResponse
|
||||
extends DeleteResponse<"variant", AdminProduct> {}
|
||||
|
||||
export interface AdminExportProductResponse {
|
||||
workflow_id: string
|
||||
}
|
||||
|
||||
export interface AdminBatchProductVariantResponse
|
||||
extends BatchMethodResponse<AdminProductVariant> {}
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
import { FilterableProductProps } from "../../product"
|
||||
|
||||
export interface ExportProductsDTO {
|
||||
select: string[]
|
||||
filter?: FilterableProductProps
|
||||
}
|
||||
@@ -2,3 +2,4 @@ export * from "./create-product-variants"
|
||||
export * from "./create-products"
|
||||
export * from "./update-product-variants"
|
||||
export * from "./update-products"
|
||||
export * from "./export-products"
|
||||
Reference in new issue
Block a user