* init * create new interface * prep integration tests * update denpencies * inventory service partial tests * finalize integration tests * add events * align events * adjust inventory level reservation levels * add test validating reserved quantity after reseration item update * fix nits * rename to inventory-next * update yarn.lock * remove changelog * remove fixtures * remove unused files * ready for review * Update packages/inventory-next/package.json Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com> * pr feedback * add tests and docs for partition-array util * remote decorators from private method * fix unit tests * add migrations * add foreign keys * fix build --------- Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
45 lines
1.2 KiB
TypeScript
45 lines
1.2 KiB
TypeScript
import * as InventoryModels from "@models"
|
|
import * as InventoryRepositories from "@repositories"
|
|
import * as InventoryServices from "@services"
|
|
|
|
import InventoryService from "./services/inventory"
|
|
import { ModuleExports } from "@medusajs/types"
|
|
import { Modules } from "@medusajs/modules-sdk"
|
|
import { ModulesSdkUtils } from "@medusajs/utils"
|
|
|
|
const migrationScriptOptions = {
|
|
moduleName: Modules.INVENTORY,
|
|
models: InventoryModels,
|
|
pathToMigrations: __dirname + "/migrations",
|
|
}
|
|
|
|
const runMigrations = ModulesSdkUtils.buildMigrationScript(
|
|
migrationScriptOptions
|
|
)
|
|
|
|
const revertMigration = ModulesSdkUtils.buildRevertMigrationScript(
|
|
migrationScriptOptions
|
|
)
|
|
|
|
const containerLoader = ModulesSdkUtils.moduleContainerLoaderFactory({
|
|
moduleModels: InventoryModels,
|
|
moduleRepositories: InventoryRepositories,
|
|
moduleServices: InventoryServices,
|
|
})
|
|
|
|
const connectionLoader = ModulesSdkUtils.mikroOrmConnectionLoaderFactory({
|
|
moduleName: Modules.INVENTORY,
|
|
moduleModels: Object.values(InventoryModels),
|
|
migrationsPath: __dirname + "/migrations",
|
|
})
|
|
|
|
const service = InventoryService
|
|
const loaders = [containerLoader, connectionLoader]
|
|
|
|
export const moduleDefinition: ModuleExports = {
|
|
service,
|
|
loaders,
|
|
revertMigration,
|
|
runMigrations,
|
|
}
|