Merge pull request #564 from saurabh042/chore/lint
fix: Chore/lint chore: Make packages/medusa/src/services/inventory.js pass linting #509
This commit is contained in:
@@ -4,7 +4,6 @@
|
|||||||
/packages/medusa/src/services/claim-item.js
|
/packages/medusa/src/services/claim-item.js
|
||||||
/packages/medusa/src/services/event-bus.js
|
/packages/medusa/src/services/event-bus.js
|
||||||
/packages/medusa/src/services/fulfillment-provider.js
|
/packages/medusa/src/services/fulfillment-provider.js
|
||||||
/packages/medusa/src/services/inventory.js
|
|
||||||
/packages/medusa/src/services/middleware.js
|
/packages/medusa/src/services/middleware.js
|
||||||
/packages/medusa/src/services/oauth.js
|
/packages/medusa/src/services/oauth.js
|
||||||
/packages/medusa/src/services/payment-provider.js
|
/packages/medusa/src/services/payment-provider.js
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ class FulfillmentProviderService {
|
|||||||
|
|
||||||
async listFulfillmentOptions(providers) {
|
async listFulfillmentOptions(providers) {
|
||||||
const result = await Promise.all(
|
const result = await Promise.all(
|
||||||
providers.map(async p => {
|
providers.map(async (p) => {
|
||||||
const provider = await this.retrieveProvider(p)
|
const provider = await this.retrieveProvider(p)
|
||||||
return {
|
return {
|
||||||
provider_id: p,
|
provider_id: p,
|
||||||
@@ -41,7 +41,8 @@ class FulfillmentProviderService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns {FulfillmentService} the payment fulfillment provider
|
* @param {string} provider_id - the provider id
|
||||||
|
* @return {FulfillmentService} the payment fulfillment provider
|
||||||
*/
|
*/
|
||||||
retrieveProvider(provider_id) {
|
retrieveProvider(provider_id) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -29,8 +29,8 @@ class InventoryService extends BaseService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the inventory of a variant based on a given adjustment.
|
* Updates the inventory of a variant based on a given adjustment.
|
||||||
* @params {string} variantId - the id of the variant to update
|
* @param {string} variantId - the id of the variant to update
|
||||||
* @params {number} adjustment - the number to adjust the inventory quantity by
|
* @param {number} adjustment - the number to adjust the inventory quantity by
|
||||||
* @return {Promise} resolves to the update result.
|
* @return {Promise} resolves to the update result.
|
||||||
*/
|
*/
|
||||||
async adjustInventory(variantId, adjustment) {
|
async adjustInventory(variantId, adjustment) {
|
||||||
@@ -39,7 +39,7 @@ class InventoryService extends BaseService {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.atomicPhase_(async manager => {
|
return this.atomicPhase_(async (manager) => {
|
||||||
const variant = await this.productVariantService_.retrieve(variantId)
|
const variant = await this.productVariantService_.retrieve(variantId)
|
||||||
// if inventory is managed then update
|
// if inventory is managed then update
|
||||||
if (variant.manage_inventory) {
|
if (variant.manage_inventory) {
|
||||||
@@ -55,8 +55,8 @@ class InventoryService extends BaseService {
|
|||||||
* Checks if the inventory of a variant can cover a given quantity. Will
|
* Checks if the inventory of a variant can cover a given quantity. Will
|
||||||
* return true if the variant doesn't have managed inventory or if the variant
|
* return true if the variant doesn't have managed inventory or if the variant
|
||||||
* allows backorders or if the inventory quantity is greater than `quantity`.
|
* allows backorders or if the inventory quantity is greater than `quantity`.
|
||||||
* @params {string} variantId - the id of the variant to check
|
* @param {string} variantId - the id of the variant to check
|
||||||
* @params {number} quantity - the number of units to check availability for
|
* @param {number} quantity - the number of units to check availability for
|
||||||
* @return {boolean} true if the inventory covers the quantity
|
* @return {boolean} true if the inventory covers the quantity
|
||||||
*/
|
*/
|
||||||
async confirmInventory(variantId, quantity) {
|
async confirmInventory(variantId, quantity) {
|
||||||
|
|||||||
Reference in New Issue
Block a user