@@ -5,8 +5,8 @@ import {
|
||||
Modules,
|
||||
} from "@medusajs/modules-sdk"
|
||||
import { IEventBusService, IStockLocationService } from "@medusajs/types"
|
||||
import { StockLocationServiceInitializeOptions } from "../types"
|
||||
import { moduleDefinition } from "../module-definition"
|
||||
import { StockLocationServiceInitializeOptions } from "../types"
|
||||
|
||||
export const initialize = async (
|
||||
options: StockLocationServiceInitializeOptions | ExternalModuleDeclaration,
|
||||
@@ -15,7 +15,7 @@ export const initialize = async (
|
||||
}
|
||||
): Promise<IStockLocationService> => {
|
||||
const serviceKey = Modules.STOCK_LOCATION
|
||||
const loaded = await MedusaModule.bootstrap(
|
||||
const loaded = await MedusaModule.bootstrap<IStockLocationService>(
|
||||
serviceKey,
|
||||
"@medusajs/stock-location",
|
||||
options as InternalModuleDeclaration | ExternalModuleDeclaration,
|
||||
@@ -23,5 +23,5 @@ export const initialize = async (
|
||||
injectedDependencies
|
||||
)
|
||||
|
||||
return loaded[serviceKey] as IStockLocationService
|
||||
return loaded[serviceKey]
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
import { Modules } from "@medusajs/modules-sdk"
|
||||
import { JoinerServiceConfig } from "@medusajs/types"
|
||||
|
||||
export const joinerConfig: JoinerServiceConfig = {
|
||||
serviceName: Modules.STOCK_LOCATION,
|
||||
primaryKeys: ["id"],
|
||||
alias: [
|
||||
{
|
||||
name: "stock_location",
|
||||
},
|
||||
{
|
||||
name: "stock_locations",
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import {
|
||||
FilterableStockLocationProps,
|
||||
FindConfig,
|
||||
IEventBusService,
|
||||
JoinerServiceConfig,
|
||||
MODULE_RESOURCE_TYPE,
|
||||
SharedContext,
|
||||
StockLocationAddressInput,
|
||||
@@ -11,13 +12,13 @@ import {
|
||||
} from "@medusajs/types"
|
||||
import {
|
||||
InjectEntityManager,
|
||||
isDefined,
|
||||
MedusaContext,
|
||||
MedusaError,
|
||||
isDefined,
|
||||
setMetadata,
|
||||
} from "@medusajs/utils"
|
||||
import { EntityManager } from "typeorm"
|
||||
|
||||
import { joinerConfig } from "../joiner-config"
|
||||
import { StockLocation, StockLocationAddress } from "../models"
|
||||
import { buildQuery } from "../utils/build-query"
|
||||
|
||||
@@ -49,6 +50,10 @@ export default class StockLocationService {
|
||||
this.eventBusService_ = eventBusService
|
||||
}
|
||||
|
||||
__joinerConfig(): JoinerServiceConfig {
|
||||
return joinerConfig
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists all stock locations that match the given selector.
|
||||
* @param selector - Properties to filter by.
|
||||
|
||||
Reference in New Issue
Block a user