chore: Refactor and improve abstract module service factory (#7688)
* chore: Refactor and improve abstract module service factory * align naming * clean up some template args and tests * partially migrate modules * partially migrate modules * migrate more modules * migrate last modules * fix typings * rename interface * rename interface * fixes * fixes * rm local plain tests
This commit is contained in:
@@ -14,7 +14,7 @@ export default async ({
|
||||
const logger =
|
||||
container.resolve<Logger>(ContainerRegistrationKeys.LOGGER) ?? console
|
||||
const { currencyService_ } = container.resolve<{
|
||||
currencyService_: ModulesSdkTypes.InternalModuleService<Currency>
|
||||
currencyService_: ModulesSdkTypes.IMedusaInternalService<Currency>
|
||||
}>(ModuleRegistrationName.CURRENCY)
|
||||
|
||||
try {
|
||||
|
||||
@@ -1,30 +1,29 @@
|
||||
import {
|
||||
BaseFilterable,
|
||||
Context,
|
||||
CurrencyTypes,
|
||||
DAL,
|
||||
FilterableCurrencyProps,
|
||||
FindConfig,
|
||||
ICurrencyModuleService,
|
||||
InternalModuleDeclaration,
|
||||
ModuleJoinerConfig,
|
||||
ModulesSdkTypes,
|
||||
ICurrencyModuleService,
|
||||
CurrencyTypes,
|
||||
Context,
|
||||
FindConfig,
|
||||
FilterableCurrencyProps,
|
||||
BaseFilterable,
|
||||
} from "@medusajs/types"
|
||||
import { ModulesSdkUtils } from "@medusajs/utils"
|
||||
|
||||
import { Currency } from "@models"
|
||||
import { entityNameToLinkableKeysMap, joinerConfig } from "../joiner-config"
|
||||
|
||||
const generateMethodForModels = []
|
||||
const generateMethodForModels = {}
|
||||
|
||||
type InjectedDependencies = {
|
||||
baseRepository: DAL.RepositoryService
|
||||
currencyService: ModulesSdkTypes.InternalModuleService<any>
|
||||
currencyService: ModulesSdkTypes.IMedusaInternalService<any>
|
||||
}
|
||||
|
||||
export default class CurrencyModuleService<TEntity extends Currency = Currency>
|
||||
extends ModulesSdkUtils.abstractModuleServiceFactory<
|
||||
InjectedDependencies,
|
||||
extends ModulesSdkUtils.MedusaService<
|
||||
CurrencyTypes.CurrencyDTO,
|
||||
{
|
||||
Currency: { dto: CurrencyTypes.CurrencyDTO }
|
||||
@@ -33,7 +32,7 @@ export default class CurrencyModuleService<TEntity extends Currency = Currency>
|
||||
implements ICurrencyModuleService
|
||||
{
|
||||
protected baseRepository_: DAL.RepositoryService
|
||||
protected readonly currencyService_: ModulesSdkTypes.InternalModuleService<TEntity>
|
||||
protected readonly currencyService_: ModulesSdkTypes.IMedusaInternalService<TEntity>
|
||||
|
||||
constructor(
|
||||
{ baseRepository, currencyService }: InjectedDependencies,
|
||||
|
||||
Reference in New Issue
Block a user