feat(types, product, utils, medusa): Include shared connection for modules (#4626)
This commit is contained in:
1 parent
a2d7540e40
commit
3f3a84262c
26 files changed
+476
-168
No files matched your search
@@ -1,3 +1,4 @@
|
||||
import { Context } from "@medusajs/types"
|
||||
import { DALUtils } from "@medusajs/utils"
|
||||
|
||||
class CustomRepository extends DALUtils.MikroOrmBaseRepository {
|
||||
@@ -5,12 +6,44 @@ class CustomRepository extends DALUtils.MikroOrmBaseRepository {
|
||||
// @ts-ignore
|
||||
super(...arguments)
|
||||
}
|
||||
}
|
||||
|
||||
CustomRepository.prototype.find = jest.fn().mockImplementation(async () => [])
|
||||
CustomRepository.prototype.findAndCount = jest
|
||||
.fn()
|
||||
.mockImplementation(async () => [])
|
||||
find = jest.fn().mockImplementation(async () => [])
|
||||
findAndCount = jest.fn().mockImplementation(async () => [])
|
||||
create = jest.fn()
|
||||
update = jest.fn()
|
||||
delete = jest.fn()
|
||||
softDelete = jest.fn()
|
||||
restore = jest.fn()
|
||||
|
||||
async transaction<TManager = unknown>(
|
||||
task: (transactionManager: TManager) => Promise<any>,
|
||||
options: {
|
||||
isolationLevel?: string
|
||||
enableNestedTransactions?: boolean
|
||||
transaction?: TManager
|
||||
} = {}
|
||||
): Promise<any> {
|
||||
return super.transaction(task, options)
|
||||
}
|
||||
|
||||
getActiveManager<TManager = unknown>({
|
||||
transactionManager,
|
||||
manager,
|
||||
}: Context = {}): TManager {
|
||||
return super.getActiveManager({ transactionManager, manager })
|
||||
}
|
||||
|
||||
getFreshManager<TManager = unknown>(): TManager {
|
||||
return super.getFreshManager()
|
||||
}
|
||||
|
||||
async serialize<TOutput extends object | object[]>(
|
||||
data: any,
|
||||
options?: any
|
||||
): Promise<TOutput> {
|
||||
return super.serialize(data, options)
|
||||
}
|
||||
}
|
||||
|
||||
export class ProductRepository extends CustomRepository {}
|
||||
export class ProductTagRepository extends CustomRepository {}
|
||||
|
||||
Reference in new issue
Block a user