feat(medusa, types, utils, workflow): Migrate medusa workflow to the workflow package (#4682)
This commit is contained in:
1 parent
433914ae01
commit
dc46927bc6
68 files changed
+1224
-1064
No files matched your search
@@ -14,8 +14,12 @@ import {
|
||||
Unique,
|
||||
} from "@mikro-orm/core"
|
||||
|
||||
import { ProductTypes } from "@medusajs/types"
|
||||
import { DALUtils, generateEntityId, kebabCase } from "@medusajs/utils"
|
||||
import {
|
||||
DALUtils,
|
||||
generateEntityId,
|
||||
kebabCase,
|
||||
ProductUtils,
|
||||
} from "@medusajs/utils"
|
||||
import ProductCategory from "./product-category"
|
||||
import ProductCollection from "./product-collection"
|
||||
import ProductOption from "./product-option"
|
||||
@@ -60,8 +64,8 @@ class Product {
|
||||
@Property({ columnType: "boolean", default: false })
|
||||
is_giftcard!: boolean
|
||||
|
||||
@Enum(() => ProductTypes.ProductStatus)
|
||||
status!: ProductTypes.ProductStatus
|
||||
@Enum(() => ProductUtils.ProductStatus)
|
||||
status!: ProductUtils.ProductStatus
|
||||
|
||||
@Property({ columnType: "text", nullable: true })
|
||||
thumbnail?: string | null
|
||||
|
||||
@@ -3,7 +3,6 @@ import {
|
||||
Context,
|
||||
DAL,
|
||||
FindConfig,
|
||||
ProductStatus,
|
||||
ProductTypes,
|
||||
WithRequiredProperty,
|
||||
} from "@medusajs/types"
|
||||
@@ -14,6 +13,7 @@ import {
|
||||
MedusaContext,
|
||||
MedusaError,
|
||||
ModulesSdkUtils,
|
||||
ProductUtils,
|
||||
} from "@medusajs/utils"
|
||||
import { ProductRepository } from "@repositories"
|
||||
|
||||
@@ -124,7 +124,7 @@ export default class ProductService<TEntity extends Product = Product> {
|
||||
@MedusaContext() sharedContext: Context = {}
|
||||
): Promise<TEntity[]> {
|
||||
data.forEach((product) => {
|
||||
product.status ??= ProductStatus.DRAFT
|
||||
product.status ??= ProductUtils.ProductStatus.DRAFT
|
||||
})
|
||||
|
||||
return (await (this.productRepository_ as ProductRepository).create(
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ProductStatus, ProductCategoryDTO } from "@medusajs/types"
|
||||
import { ProductUtils } from "@medusajs/utils"
|
||||
|
||||
export type ProductEventData = {
|
||||
id: string
|
||||
@@ -20,7 +20,7 @@ export interface UpdateProductDTO {
|
||||
images?: { id?: string; url: string }[]
|
||||
thumbnail?: string
|
||||
handle?: string
|
||||
status?: ProductStatus
|
||||
status?: ProductUtils.ProductStatus
|
||||
collection_id?: string
|
||||
width?: number
|
||||
height?: number
|
||||
|
||||
Reference in new issue
Block a user