feat: refactor module joiner config and links generation (#7859)

* feat: refactor module joiner config and links generation

* improve typings

* WIP

* WIP

* WIP

* rename type file

* create link config

* finish typings and add utils

* improve links

* WIP typings

* finalize ExportModule utils

* finalize ExportModule utils

* fix: dml tests

* improve and fixes

* simplify typings with id changes

* add toJSON

* multiple fixes and entity builder fixes

* fix currency searchable

* fix tests

* medusa service refactoring

* cleanup

* cleanup and fixes

* make module name optional

* renaming

---------

Co-authored-by: Harminder Virk <virk.officials@gmail.com>
This commit is contained in:
Adrien de Peretti
2024-07-03 13:12:49 +02:00
committed by GitHub
co-authored by Harminder Virk
parent 5aa62e59e4
commit 617a5972bf
89 changed files with 1706 additions and 950 deletions
+1 -9
View File
@@ -1,11 +1,3 @@
import {
buildEntitiesNameToLinkableKeysMap,
defineJoinerConfig,
MapToConfig,
Modules,
} from "@medusajs/utils"
import { defineJoinerConfig, Modules } from "@medusajs/utils"
export const joinerConfig = defineJoinerConfig(Modules.REGION)
export const entityNameToLinkableKeysMap: MapToConfig =
buildEntitiesNameToLinkableKeysMap(joinerConfig.linkableKeys)
@@ -3,9 +3,9 @@ import {
CreateRegionDTO,
DAL,
FilterableRegionProps,
IRegionModuleService,
InferEntityType,
InternalModuleDeclaration,
IRegionModuleService,
ModuleJoinerConfig,
ModulesSdkTypes,
RegionCountryDTO,
@@ -15,20 +15,20 @@ import {
UpsertRegionDTO,
} from "@medusajs/types"
import {
arrayDifference,
getDuplicates,
InjectManager,
InjectTransactionManager,
isString,
MedusaContext,
MedusaError,
MedusaService,
arrayDifference,
getDuplicates,
isString,
promiseAll,
removeUndefined,
} from "@medusajs/utils"
import { RegionCountry as Country, Region } from "@models"
import { Region, RegionCountry as Country } from "@models"
import { UpdateRegionInput } from "@types"
import { entityNameToLinkableKeysMap, joinerConfig } from "../joiner-config"
import { joinerConfig } from "../joiner-config"
type InjectedDependencies = {
baseRepository: DAL.RepositoryService
@@ -44,7 +44,7 @@ export default class RegionModuleService
Country: {
dto: RegionCountryDTO
}
}>({ Region, Country }, entityNameToLinkableKeysMap)
}>({ Region, Country })
implements IRegionModuleService
{
protected baseRepository_: DAL.RepositoryService