From dc120121c12bd2722d97c65e242888bb552ef78a Mon Sep 17 00:00:00 2001 From: Riqwan Thamir Date: Mon, 19 Jun 2023 16:12:47 +0200 Subject: [PATCH] fix(product, types): correct path for migration files + fix types on products service module (#4348) * chore: correct path for migration files * chore: resolve the path for migrations to be picked up * chore: fix types on product service interface * chore: update changeset to reflect type changes * chore: changed changeset to the correct format --- .changeset/slow-chicken-report.md | 6 +++++ .../product/src/utils/create-connection.ts | 3 +-- packages/types/src/product/service.ts | 22 +++++++++---------- 3 files changed, 18 insertions(+), 13 deletions(-) create mode 100644 .changeset/slow-chicken-report.md diff --git a/.changeset/slow-chicken-report.md b/.changeset/slow-chicken-report.md new file mode 100644 index 0000000000..3a9d3c727d --- /dev/null +++ b/.changeset/slow-chicken-report.md @@ -0,0 +1,6 @@ +--- +"@medusajs/product": patch +"@medusajs/types": patch +--- + +fix(product, types): correct path for migration files + fix types on product module service interface \ No newline at end of file diff --git a/packages/product/src/utils/create-connection.ts b/packages/product/src/utils/create-connection.ts index 36c346c2a4..814d83eb1e 100644 --- a/packages/product/src/utils/create-connection.ts +++ b/packages/product/src/utils/create-connection.ts @@ -1,6 +1,5 @@ import { MikroORM, PostgreSqlDriver } from "@mikro-orm/postgresql" import { ProductServiceInitializeOptions } from "../types" -import { Utils } from "@mikro-orm/core" export async function createConnection( database: ProductServiceInitializeOptions["database"], @@ -20,7 +19,7 @@ export async function createConnection( tsNode: process.env.APP_ENV === "development", type: "postgresql", migrations: { - path: Utils.detectTsNode() ? "src/migrations" : "dist/migrations", + path: __dirname + "/../migrations", }, }) diff --git a/packages/types/src/product/service.ts b/packages/types/src/product/service.ts index 0f74f34876..3d8914b16c 100644 --- a/packages/types/src/product/service.ts +++ b/packages/types/src/product/service.ts @@ -21,37 +21,37 @@ export interface IProductModuleService< TProductCategory = any > { list( - filter: FilterableProductProps, + filters?: FilterableProductProps, config?: FindConfig, - context?: SharedContext + sharedContext?: SharedContext ): Promise listAndCount( - filter: FilterableProductProps, + filters?: FilterableProductProps, config?: FindConfig, - context?: SharedContext + sharedContext?: SharedContext ): Promise<[ProductDTO[], number]> listTags( - filter: FilterableProductTagProps, + filters?: FilterableProductTagProps, config?: FindConfig, - context?: SharedContext + sharedContext?: SharedContext ): Promise listVariants( - filter: FilterableProductVariantProps, + filters?: FilterableProductVariantProps, config?: FindConfig, - context?: SharedContext + sharedContext?: SharedContext ): Promise listCollections( - filter: FilterableProductCollectionProps, + filters?: FilterableProductCollectionProps, config?: FindConfig, - context?: SharedContext + sharedContext?: SharedContext ): Promise listCategories( - filters: FilterableProductCategoryProps, + filters?: FilterableProductCategoryProps, config?: FindConfig, sharedContext?: SharedContext ): Promise