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:
co-authored by
Harminder Virk
parent
5aa62e59e4
commit
617a5972bf
@@ -1,11 +1,3 @@
|
||||
import {
|
||||
buildEntitiesNameToLinkableKeysMap,
|
||||
defineJoinerConfig,
|
||||
MapToConfig,
|
||||
Modules,
|
||||
} from "@medusajs/utils"
|
||||
import { defineJoinerConfig, Modules } from "@medusajs/utils"
|
||||
|
||||
export const joinerConfig = defineJoinerConfig(Modules.SALES_CHANNEL)
|
||||
|
||||
export const entityNameToLinkableKeysMap: MapToConfig =
|
||||
buildEntitiesNameToLinkableKeysMap(joinerConfig.linkableKeys)
|
||||
|
||||
@@ -9,6 +9,7 @@ import {
|
||||
ModulesSdkTypes,
|
||||
SalesChannelDTO,
|
||||
UpdateSalesChannelDTO,
|
||||
UpsertSalesChannelDTO,
|
||||
} from "@medusajs/types"
|
||||
import {
|
||||
InjectManager,
|
||||
@@ -20,10 +21,8 @@ import {
|
||||
} from "@medusajs/utils"
|
||||
|
||||
import { SalesChannel } from "@models"
|
||||
|
||||
import { UpsertSalesChannelDTO } from "@medusajs/types"
|
||||
import { UpdateSalesChanneInput } from "@types"
|
||||
import { entityNameToLinkableKeysMap, joinerConfig } from "../joiner-config"
|
||||
import { joinerConfig } from "../joiner-config"
|
||||
|
||||
type InjectedDependencies = {
|
||||
baseRepository: DAL.RepositoryService
|
||||
@@ -31,10 +30,9 @@ type InjectedDependencies = {
|
||||
}
|
||||
|
||||
export default class SalesChannelModuleService
|
||||
extends MedusaService<{ SalesChannel: { dto: SalesChannelDTO } }>(
|
||||
{ SalesChannel },
|
||||
entityNameToLinkableKeysMap
|
||||
)
|
||||
extends MedusaService<{ SalesChannel: { dto: SalesChannelDTO } }>({
|
||||
SalesChannel,
|
||||
})
|
||||
implements ISalesChannelModuleService
|
||||
{
|
||||
protected baseRepository_: DAL.RepositoryService
|
||||
|
||||
Reference in New Issue
Block a user