chore(orchestration): modules method context (#9669)

** What **
* Test to check if the MedusaContext is being injected when calling a Module's method
This commit is contained in:
Carlos R. L. Rodrigues
2024-10-18 21:08:06 +00:00
committed by GitHub
parent 8209d936a0
commit 6fa98b6a4d
7 changed files with 132 additions and 4 deletions
@@ -0,0 +1,11 @@
import { ModuleExports } from "@medusajs/types"
import { ModuleService } from "./services/module-service"
const moduleExports: ModuleExports = {
service: ModuleService,
}
export * from "./models"
export * from "./services/module-service"
export default moduleExports
@@ -0,0 +1,6 @@
import { model } from "@medusajs/utils"
export const dmlEntity = model.define("dmlEntity", {
id: model.id().primaryKey(),
name: model.text(),
})
@@ -0,0 +1 @@
export * from "./dml-entity"
@@ -0,0 +1,17 @@
import { IModuleService } from "@medusajs/types"
import { MedusaContext } from "@medusajs/utils"
// @ts-expect-error
export class ModuleService implements IModuleService {
public property = "value"
public dynProperty
constructor() {
this.dynProperty = {
key: "key value",
}
}
async methodName(input, @MedusaContext() context) {
return input + " called"
}
}