breaking: rename package names to be consistent and under @medusajs scope (#9580)

This commit is contained in:
Harminder Virk
2024-10-16 22:28:09 +05:30
committed by GitHub
parent cc1a25abb2
commit 68560787e5
289 changed files with 483 additions and 474 deletions

View File

@@ -0,0 +1,5 @@
describe("noop", function () {
it("should run", function () {
expect(true).toBe(true)
})
})

View File

@@ -0,0 +1,2 @@
export { default as InventoryLevelService } from "./inventory-level"
export { default as InventoryModuleService } from "./inventory-module"

View File

@@ -0,0 +1,69 @@
import { Context } from "@medusajs/framework/types"
import { BigNumber, ModulesSdkUtils } from "@medusajs/framework/utils"
import { InventoryLevelRepository } from "@repositories"
import { InventoryLevel } from "../models/inventory-level"
type InjectedDependencies = {
inventoryLevelRepository: InventoryLevelRepository
}
export default class InventoryLevelService extends ModulesSdkUtils.MedusaInternalService<
InjectedDependencies,
InventoryLevel
>(InventoryLevel) {
protected readonly inventoryLevelRepository: InventoryLevelRepository
constructor(container: InjectedDependencies) {
super(container)
this.inventoryLevelRepository = container.inventoryLevelRepository
}
async retrieveStockedQuantity(
inventoryItemId: string,
locationIds: string[] | string,
context: Context = {}
): Promise<BigNumber> {
const locationIdArray = Array.isArray(locationIds)
? locationIds
: [locationIds]
return await this.inventoryLevelRepository.getStockedQuantity(
inventoryItemId,
locationIdArray,
context
)
}
async getAvailableQuantity(
inventoryItemId: string,
locationIds: string[] | string,
context: Context = {}
): Promise<BigNumber> {
const locationIdArray = Array.isArray(locationIds)
? locationIds
: [locationIds]
return await this.inventoryLevelRepository.getAvailableQuantity(
inventoryItemId,
locationIdArray,
context
)
}
async getReservedQuantity(
inventoryItemId: string,
locationIds: string[] | string,
context: Context = {}
) {
if (!Array.isArray(locationIds)) {
locationIds = [locationIds]
}
return await this.inventoryLevelRepository.getReservedQuantity(
inventoryItemId,
locationIds,
context
)
}
}

File diff suppressed because it is too large Load Diff