feat: Add skeleton for api key module (#6451)

Adds a module skeleton for the API Key module.
Implementation of functionalities will follow in separate PRs
This commit is contained in:
Stevche Radevski
2024-02-20 12:28:57 +00:00
committed by GitHub
parent cfefd59249
commit 269be1b64a
30 changed files with 616 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
import { Modules } from "@medusajs/modules-sdk"
import { ModuleJoinerConfig } from "@medusajs/types"
import { MapToConfig } from "@medusajs/utils"
// TODO manage the config
export const LinkableKeys: Record<string, string> = {}
const entityLinkableKeysMap: MapToConfig = {}
Object.entries(LinkableKeys).forEach(([key, value]) => {
entityLinkableKeysMap[value] ??= []
entityLinkableKeysMap[value].push({
mapTo: key,
valueFrom: key.split("_").pop()!,
})
})
export const entityNameToLinkableKeysMap: MapToConfig = entityLinkableKeysMap
export const joinerConfig: ModuleJoinerConfig = {
serviceName: Modules.API_KEY,
primaryKeys: ["id"],
linkableKeys: LinkableKeys,
alias: [],
} as ModuleJoinerConfig