fix(product, types, workflows): Update product variant workflow (#5668)

**What**
- Fix issues with update-variant workflow: 
  - other variants than the updated variant are no longer removed 
  - options are updated properly


Co-authored-by: Riqwan Thamir <5105988+riqwan@users.noreply.github.com>
This commit is contained in:
Philip KorsholmandRiqwan Thamir authored and GitHub committed 2023-11-23 14:35:01 +00:00
1 parent b25b29fe7b
commit a39ce125cc
16 files changed
+617 -44

No files matched your search

+22 -21
View File
@@ -83,43 +83,43 @@ export interface ProductDTO {
material?: string | null
/**
* The associated product collection.
*
*
* @expandable
*/
collection: ProductCollectionDTO
/**
* The associated product categories.
*
*
* @expandable
*/
categories?: ProductCategoryDTO[] | null
/**
* The associated product type.
*
*
* @expandable
*/
type: ProductTypeDTO[]
/**
* The associated product tags.
*
*
* @expandable
*/
tags: ProductTagDTO[]
/**
* The associated product variants.
*
*
* @expandable
*/
variants: ProductVariantDTO[]
/**
* The associated product options.
*
*
* @expandable
*/
options: ProductOptionDTO[]
/**
* The associated product images.
*
*
* @expandable
*/
images: ProductImageDTO[]
@@ -226,17 +226,17 @@ export interface ProductVariantDTO {
width?: number | null
/**
* The associated product options.
*
*
* @expandable
*/
options: ProductOptionValueDTO
options: ProductOptionValueDTO[]
/**
* Holds custom data in key-value pairs.
*/
metadata?: Record<string, unknown> | null
/**
* The associated product.
*
*
* @expandable
*/
product: ProductDTO
@@ -298,13 +298,13 @@ export interface ProductCategoryDTO {
rank?: number
/**
* The associated parent category.
*
*
* @expandable
*/
parent_category?: ProductCategoryDTO
/**
* The associated child categories.
*
*
* @expandable
*/
category_children: ProductCategoryDTO[]
@@ -410,7 +410,7 @@ export interface ProductTagDTO {
metadata?: Record<string, unknown> | null
/**
* The associated products.
*
*
* @expandable
*/
products?: ProductDTO[]
@@ -444,7 +444,7 @@ export interface ProductCollectionDTO {
deleted_at?: string | Date
/**
* The associated products.
*
*
* @expandable
*/
products?: ProductDTO[]
@@ -478,7 +478,7 @@ export interface ProductTypeDTO {
* @interface
*
* A product option's data.
*
*
*/
export interface ProductOptionDTO {
/**
@@ -491,13 +491,13 @@ export interface ProductOptionDTO {
title: string
/**
* The associated product.
*
*
* @expandable
*/
product: ProductDTO
/**
* The associated product option values.
*
*
* @expandable
*/
values: ProductOptionValueDTO[]
@@ -563,13 +563,13 @@ export interface ProductOptionValueDTO {
value: string
/**
* The associated product option.
*
*
* @expandable
*/
option: ProductOptionDTO
/**
* The associated product variant.
*
*
* @expandable
*/
variant: ProductVariantDTO
@@ -612,7 +612,7 @@ export interface FilterableProductProps
/**
* Filters on a product's tags.
*/
tags?: {
tags?: {
/**
* Values to filter product tags by.
*/
@@ -761,7 +761,7 @@ export interface FilterableProductVariantProps
/**
* Filter product variants by their associated options.
*/
options?: {
options?: {
/**
* IDs to filter options by.
*/
@@ -986,6 +986,7 @@ export interface CreateProductVariantOptionDTO {
* The value of a product variant option.
*/
value: string
option_id?: string
}
+9 -3
View File
@@ -26,12 +26,13 @@ import {
UpdateProductOptionDTO,
UpdateProductTagDTO,
UpdateProductTypeDTO,
UpdateProductVariantDTO,
} from "./common"
import { FindConfig } from "../common"
import { RestoreReturn, SoftDeleteReturn } from "../dal"
import { ModuleJoinerConfig } from "../modules-sdk"
import { Context } from "../shared-context"
import { FindConfig } from "../common"
import { ModuleJoinerConfig } from "../modules-sdk"
export interface IProductModuleService {
/**
@@ -1490,6 +1491,11 @@ export interface IProductModuleService {
sharedContext?: Context
): Promise<ProductVariantDTO[]>
updateVariants(
data: UpdateProductVariantDTO[],
sharedContext?: Context
): Promise<ProductVariantDTO[]>
createVariants(
data: CreateProductVariantDTO[],
sharedContext?: Context