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:
@@ -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"
|
||||
+17
@@ -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"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user