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:
committed by
GitHub
parent
5aa62e59e4
commit
617a5972bf
@@ -1,19 +1,11 @@
|
||||
import {
|
||||
buildEntitiesNameToLinkableKeysMap,
|
||||
defineJoinerConfig,
|
||||
MapToConfig,
|
||||
Modules,
|
||||
} from "@medusajs/utils"
|
||||
import { defineJoinerConfig, Modules } from "@medusajs/utils"
|
||||
import { Price, PriceList, PriceSet } from "@models"
|
||||
|
||||
export const joinerConfig = defineJoinerConfig(Modules.PRICING, {
|
||||
entityQueryingConfig: [PriceSet, PriceList, Price],
|
||||
models: [PriceSet, PriceList, Price],
|
||||
linkableKeys: {
|
||||
price_set_id: PriceSet.name,
|
||||
price_list_id: PriceList.name,
|
||||
price_id: Price.name,
|
||||
},
|
||||
})
|
||||
|
||||
export const entityNameToLinkableKeysMap: MapToConfig =
|
||||
buildEntitiesNameToLinkableKeysMap(joinerConfig.linkableKeys)
|
||||
|
||||
@@ -38,7 +38,7 @@ import { Price, PriceList, PriceListRule, PriceRule, PriceSet } from "@models"
|
||||
|
||||
import { ServiceTypes } from "@types"
|
||||
import { eventBuilders, validatePriceListDates } from "@utils"
|
||||
import { entityNameToLinkableKeysMap, joinerConfig } from "../joiner-config"
|
||||
import { joinerConfig } from "../joiner-config"
|
||||
import { CreatePriceListDTO, UpsertPriceDTO } from "src/types/services"
|
||||
|
||||
type InjectedDependencies = {
|
||||
@@ -70,7 +70,7 @@ export default class PricingModuleService
|
||||
}
|
||||
PriceList: { dto: PricingTypes.PriceListDTO }
|
||||
PriceListRule: { dto: PricingTypes.PriceListRuleDTO }
|
||||
}>(generateMethodForModels, entityNameToLinkableKeysMap)
|
||||
}>(generateMethodForModels)
|
||||
implements PricingTypes.IPricingModuleService
|
||||
{
|
||||
protected baseRepository_: DAL.RepositoryService
|
||||
|
||||
Reference in New Issue
Block a user