fix(dashboard, product): product attributes update with a relation update (#13019)

* fix(dashboard, product): product attributes update with a relation update

* fix: rm log

* chore: refactor
This commit is contained in:
Frane Polić
2025-07-23 21:01:50 +02:00
committed by GitHub
parent c71ace0be2
commit 439c711845
7 changed files with 156 additions and 35 deletions
@@ -32,14 +32,14 @@ export type CancelReturnValidateOrderInput = {
* This step validates that a return can be canceled.
* If the return is canceled, its fulfillment aren't canceled,
* or it has received items, the step will throw an error.
*
*
* :::note
*
*
* You can retrieve a return details using [Query](https://docs.medusajs.com/learn/fundamentals/module-links/query),
* or [useQueryGraphStep](https://docs.medusajs.com/resources/references/medusa-workflows/steps/useQueryGraphStep).
*
*
* :::
*
*
* @example
* const data = cancelReturnValidateOrder({
* orderReturn: {
@@ -53,9 +53,7 @@ export type CancelReturnValidateOrderInput = {
*/
export const cancelReturnValidateOrder = createStep(
"validate-return",
({
orderReturn,
}: CancelReturnValidateOrderInput) => {
({ orderReturn }: CancelReturnValidateOrderInput) => {
const orderReturn_ = orderReturn as ReturnDTO & {
payment_collections: PaymentCollectionDTO[]
fulfillments: FulfillmentDTO[]
@@ -92,12 +90,12 @@ export const cancelReturnValidateOrder = createStep(
export const cancelReturnWorkflowId = "cancel-return"
/**
* This workflow cancels a return. It's used by the
* This workflow cancels a return. It's used by the
* [Cancel Return Admin API Route](https://docs.medusajs.com/api/admin#returns_postreturnsidcancel).
*
*
* You can use this workflow within your customizations or your own custom workflows, allowing you
* to cancel a return in your custom flow.
*
*
* @example
* const { result } = await cancelReturnWorkflow(container)
* .run({
@@ -105,9 +103,9 @@ export const cancelReturnWorkflowId = "cancel-return"
* return_id: "return_123",
* }
* })
*
*
* @summary
*
*
* Cancel a return.
*/
export const cancelReturnWorkflow = createWorkflow(
@@ -11,9 +11,9 @@ import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
*/
export type UpdateProductsStepInput =
| {
/**
* The filters to select the products to update.
*/
/**
* The filters to select the products to update.
*/
selector: ProductTypes.FilterableProductProps
/**
* The data to update the products with.
@@ -21,19 +21,19 @@ export type UpdateProductsStepInput =
update: ProductTypes.UpdateProductDTO
}
| {
/**
* The data to create or update products.
*/
/**
* The data to create or update products.
*/
products: ProductTypes.UpsertProductDTO[]
}
export const updateProductsStepId = "update-products"
/**
* This step updates one or more products.
*
*
* @example
* To update products by their ID:
*
*
* ```ts
* const data = updateProductsStep({
* products: [
@@ -44,9 +44,9 @@ export const updateProductsStepId = "update-products"
* ]
* })
* ```
*
*
* To update products matching a filter:
*
*
* ```ts
* const data = updateProductsStep({
* selector: {
@@ -343,12 +343,12 @@ export const updateProductsWorkflowId = "update-products"
* allows you to update custom data models linked to the products.
*
* You can also use this workflow within your customizations or your own custom workflows, allowing you to wrap custom logic around product update.
*
*
* :::note
*
* Learn more about adding rules to the product variant's prices in the Pricing Module's
*
* Learn more about adding rules to the product variant's prices in the Pricing Module's
* [Price Rules](https://docs.medusajs.com/resources/commerce-modules/pricing/price-rules) documentation.
*
*
* :::
*
* @example