Chore(medusa,utils,types,inventory,stock-location): remove core dependency modules (#3531)
This commit is contained in:
committed by
GitHub
parent
bfef22b33e
commit
4e9d257d3b
@@ -1,16 +1,14 @@
|
||||
import { IInventoryService } from "@medusajs/types"
|
||||
import { MedusaError } from "@medusajs/utils"
|
||||
import { IsNumber, IsObject, IsOptional, IsString } from "class-validator"
|
||||
import { EntityManager } from "typeorm"
|
||||
import {
|
||||
ProductVariantInventoryService,
|
||||
ProductVariantService,
|
||||
} from "../../../../services"
|
||||
import { IInventoryService } from "../../../../interfaces"
|
||||
import { validator } from "../../../../utils/validator"
|
||||
|
||||
import { EntityManager } from "typeorm"
|
||||
|
||||
import { createInventoryItemTransaction } from "./transaction/create-inventory-item"
|
||||
import { MedusaError } from "medusa-core-utils"
|
||||
import { FindParams } from "../../../../types/common"
|
||||
import { validator } from "../../../../utils/validator"
|
||||
import { createInventoryItemTransaction } from "./transaction/create-inventory-item"
|
||||
|
||||
/**
|
||||
* @oas [post] /admin/inventory-items
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
import { Request, Response } from "express"
|
||||
import { IInventoryService, IStockLocationService } from "@medusajs/types"
|
||||
import { IsNumber, IsOptional, IsString } from "class-validator"
|
||||
|
||||
import {
|
||||
IInventoryService,
|
||||
IStockLocationService,
|
||||
} from "../../../../interfaces"
|
||||
import { Request, Response } from "express"
|
||||
import { FindParams } from "../../../../types/common"
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { IInventoryService } from "@medusajs/types"
|
||||
import { Request, Response } from "express"
|
||||
import { EntityManager } from "typeorm"
|
||||
import { IInventoryService } from "../../../../interfaces"
|
||||
import { ProductVariantInventoryService } from "../../../../services"
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { IInventoryService } from "@medusajs/types"
|
||||
import { Request, Response } from "express"
|
||||
import { MedusaError } from "medusa-core-utils"
|
||||
import { EntityManager } from "typeorm"
|
||||
import { IInventoryService } from "../../../../interfaces"
|
||||
|
||||
/**
|
||||
* @oas [delete] /admin/inventory-items/{id}/location-levels/{location_id}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { IInventoryService } from "../../../../interfaces"
|
||||
import { IInventoryService } from "@medusajs/types"
|
||||
import { Request, Response } from "express"
|
||||
import { FindParams } from "../../../../types/common"
|
||||
import { joinLevels } from "./utils/join-levels"
|
||||
|
||||
@@ -1,35 +1,32 @@
|
||||
import { InventoryItemDTO, InventoryLevelDTO } from "@medusajs/types"
|
||||
import { Router } from "express"
|
||||
import "reflect-metadata"
|
||||
import { ProductVariant } from "../../../../models"
|
||||
import { DeleteResponse, PaginatedResponse } from "../../../../types/common"
|
||||
import {
|
||||
InventoryItemDTO,
|
||||
InventoryLevelDTO,
|
||||
} from "../../../../types/inventory"
|
||||
import middlewares, {
|
||||
transformBody,
|
||||
transformQuery,
|
||||
} from "../../../middlewares"
|
||||
import { AdminGetInventoryItemsParams } from "./list-inventory-items"
|
||||
import { AdminGetInventoryItemsItemParams } from "./get-inventory-item"
|
||||
import {
|
||||
AdminPostInventoryItemsInventoryItemParams,
|
||||
AdminPostInventoryItemsInventoryItemReq,
|
||||
} from "./update-inventory-item"
|
||||
import { AdminGetInventoryItemsItemLocationLevelsParams } from "./list-location-levels"
|
||||
import {
|
||||
AdminPostInventoryItemsItemLocationLevelsParams,
|
||||
AdminPostInventoryItemsItemLocationLevelsReq,
|
||||
} from "./create-location-level"
|
||||
import {
|
||||
AdminPostInventoryItemsItemLocationLevelsLevelParams,
|
||||
AdminPostInventoryItemsItemLocationLevelsLevelReq,
|
||||
} from "./update-location-level"
|
||||
import { checkRegisteredModules } from "../../../middlewares/check-registered-modules"
|
||||
import { ProductVariant } from "../../../../models"
|
||||
import {
|
||||
AdminPostInventoryItemsParams,
|
||||
AdminPostInventoryItemsReq,
|
||||
} from "./create-inventory-item"
|
||||
import {
|
||||
AdminPostInventoryItemsItemLocationLevelsParams,
|
||||
AdminPostInventoryItemsItemLocationLevelsReq,
|
||||
} from "./create-location-level"
|
||||
import { AdminGetInventoryItemsItemParams } from "./get-inventory-item"
|
||||
import { AdminGetInventoryItemsParams } from "./list-inventory-items"
|
||||
import { AdminGetInventoryItemsItemLocationLevelsParams } from "./list-location-levels"
|
||||
import {
|
||||
AdminPostInventoryItemsInventoryItemParams,
|
||||
AdminPostInventoryItemsInventoryItemReq,
|
||||
} from "./update-inventory-item"
|
||||
import {
|
||||
AdminPostInventoryItemsItemLocationLevelsLevelParams,
|
||||
AdminPostInventoryItemsItemLocationLevelsLevelReq,
|
||||
} from "./update-location-level"
|
||||
|
||||
const route = Router()
|
||||
|
||||
@@ -281,10 +278,10 @@ export type AdminInventoryItemsLocationLevelsRes = {
|
||||
}
|
||||
}
|
||||
|
||||
export * from "./list-inventory-items"
|
||||
export * from "./create-inventory-item"
|
||||
export * from "./get-inventory-item"
|
||||
export * from "./update-inventory-item"
|
||||
export * from "./list-location-levels"
|
||||
export * from "./create-location-level"
|
||||
export * from "./get-inventory-item"
|
||||
export * from "./list-inventory-items"
|
||||
export * from "./list-location-levels"
|
||||
export * from "./update-inventory-item"
|
||||
export * from "./update-location-level"
|
||||
|
||||
@@ -1,20 +1,19 @@
|
||||
import { Request, Response } from "express"
|
||||
import { IsBoolean, IsOptional, IsString } from "class-validator"
|
||||
import { IInventoryService } from "@medusajs/types"
|
||||
import { Transform } from "class-transformer"
|
||||
import { IsType } from "../../../../utils/validators/is-type"
|
||||
import { getLevelsByInventoryItemId } from "./utils/join-levels"
|
||||
import { getVariantsByInventoryItemId } from "./utils/join-variants"
|
||||
import { IsBoolean, IsOptional, IsString } from "class-validator"
|
||||
import { Request, Response } from "express"
|
||||
import {
|
||||
ProductVariantInventoryService,
|
||||
ProductVariantService,
|
||||
} from "../../../../services"
|
||||
import { IInventoryService } from "../../../../interfaces"
|
||||
import {
|
||||
extendedFindParamsMixin,
|
||||
NumericalComparisonOperator,
|
||||
StringComparisonOperator,
|
||||
} from "../../../../types/common"
|
||||
import { AdminInventoryItemsListWithVariantsAndLocationLevelsRes } from "."
|
||||
import { IsType } from "../../../../utils/validators/is-type"
|
||||
import { getLevelsByInventoryItemId } from "./utils/join-levels"
|
||||
import { getVariantsByInventoryItemId } from "./utils/join-variants"
|
||||
|
||||
/**
|
||||
* @oas [get] /admin/inventory-items
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { IInventoryService } from "@medusajs/types"
|
||||
import { Request, Response } from "express"
|
||||
|
||||
import { IInventoryService } from "../../../../interfaces"
|
||||
import { FindParams } from "../../../../types/common"
|
||||
|
||||
/**
|
||||
|
||||
+9
-10
@@ -1,3 +1,12 @@
|
||||
import { IInventoryService, InventoryItemDTO } from "@medusajs/types"
|
||||
import { MedusaError } from "@medusajs/utils"
|
||||
import { EntityManager } from "typeorm"
|
||||
import { ulid } from "ulid"
|
||||
import { ProductVariant } from "../../../../../models"
|
||||
import {
|
||||
ProductVariantInventoryService,
|
||||
ProductVariantService,
|
||||
} from "../../../../../services"
|
||||
import {
|
||||
DistributedTransaction,
|
||||
TransactionHandlerType,
|
||||
@@ -6,16 +15,6 @@ import {
|
||||
TransactionState,
|
||||
TransactionStepsDefinition,
|
||||
} from "../../../../../utils/transaction"
|
||||
import { ulid } from "ulid"
|
||||
import { EntityManager } from "typeorm"
|
||||
import { IInventoryService } from "../../../../../interfaces"
|
||||
import {
|
||||
ProductVariantInventoryService,
|
||||
ProductVariantService,
|
||||
} from "../../../../../services"
|
||||
import { InventoryItemDTO } from "../../../../../types/inventory"
|
||||
import { ProductVariant } from "../../../../../models"
|
||||
import { MedusaError } from "medusa-core-utils"
|
||||
|
||||
enum actions {
|
||||
createInventoryItem = "createInventoryItem",
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import { Request, Response } from "express"
|
||||
import { IInventoryService } from "@medusajs/types"
|
||||
import { IsBoolean, IsNumber, IsOptional, IsString } from "class-validator"
|
||||
|
||||
import { IInventoryService } from "../../../../interfaces"
|
||||
import { FindParams } from "../../../../types/common"
|
||||
import { Request, Response } from "express"
|
||||
import { EntityManager } from "typeorm"
|
||||
import { FindParams } from "../../../../types/common"
|
||||
|
||||
/**
|
||||
* @oas [post] /admin/inventory-items/{id}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import { Request, Response } from "express"
|
||||
import { IInventoryService } from "@medusajs/types"
|
||||
import { IsNumber, IsOptional, Min } from "class-validator"
|
||||
|
||||
import { IInventoryService } from "../../../../interfaces"
|
||||
import { FindParams } from "../../../../types/common"
|
||||
import { Request, Response } from "express"
|
||||
import { EntityManager } from "typeorm"
|
||||
import { FindParams } from "../../../../types/common"
|
||||
|
||||
/**
|
||||
* @oas [post] /admin/inventory-items/{id}/location-levels/{location_id}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { IInventoryService } from "../../../../../interfaces"
|
||||
import {
|
||||
IInventoryService,
|
||||
InventoryItemDTO,
|
||||
InventoryLevelDTO,
|
||||
} from "../../../../../types/inventory"
|
||||
} from "@medusajs/types"
|
||||
import { LevelWithAvailability, ResponseInventoryItem } from "../../variants"
|
||||
|
||||
export const buildLevelsByInventoryItemId = (
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { InventoryItemDTO } from "@medusajs/types"
|
||||
import { ProductVariant } from "../../../../../models"
|
||||
import {
|
||||
ProductVariantInventoryService,
|
||||
ProductVariantService,
|
||||
} from "../../../../../services"
|
||||
import { InventoryItemDTO } from "../../../../../types/inventory"
|
||||
import { ProductVariant } from "../../../../../models"
|
||||
|
||||
export type InventoryItemsWithVariants = Partial<InventoryItemDTO> & {
|
||||
variants?: ProductVariant[]
|
||||
|
||||
@@ -4,10 +4,10 @@ import {
|
||||
ProductVariantInventoryService,
|
||||
} from "../../../../services"
|
||||
|
||||
import { EntityManager } from "typeorm"
|
||||
import { IInventoryService } from "@medusajs/types"
|
||||
import { MedusaError } from "medusa-core-utils"
|
||||
import { EntityManager } from "typeorm"
|
||||
import { Fulfillment } from "../../../../models"
|
||||
import { IInventoryService } from "../../../../interfaces"
|
||||
import { FindParams } from "../../../../types/common"
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { IInventoryService } from "@medusajs/types"
|
||||
import { Request, Response } from "express"
|
||||
import { IInventoryService } from "../../../../interfaces"
|
||||
import { OrderService } from "../../../../services"
|
||||
import { extendedFindParamsMixin } from "../../../../types/common"
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { isDefined, MedusaError } from "@medusajs/utils"
|
||||
import { Type } from "class-transformer"
|
||||
import {
|
||||
IsArray,
|
||||
IsBoolean,
|
||||
@@ -6,16 +8,13 @@ import {
|
||||
IsString,
|
||||
ValidateNested
|
||||
} from "class-validator"
|
||||
import { EntityManager } from "typeorm"
|
||||
import { Order, Return } from "../../../../models"
|
||||
import {
|
||||
EventBusService,
|
||||
OrderService,
|
||||
ReturnService
|
||||
} from "../../../../services"
|
||||
|
||||
import { Type } from "class-transformer"
|
||||
import { isDefined, MedusaError } from "medusa-core-utils"
|
||||
import { EntityManager } from "typeorm"
|
||||
import { Order, Return } from "../../../../models"
|
||||
import { FindParams } from "../../../../types/common"
|
||||
import { OrdersReturnItem } from "../../../../types/orders"
|
||||
|
||||
|
||||
@@ -28,21 +28,20 @@ import {
|
||||
ProductVariantPricesCreateReq,
|
||||
} from "../../../../types/product-variant"
|
||||
|
||||
import { IInventoryService } from "@medusajs/types"
|
||||
import { Type } from "class-transformer"
|
||||
import { EntityManager } from "typeorm"
|
||||
import SalesChannelFeatureFlag from "../../../../loaders/feature-flags/sales-channels"
|
||||
import { ProductStatus } from "../../../../models"
|
||||
import { Logger } from "../../../../types/global"
|
||||
import { FeatureFlagDecorators } from "../../../../utils/feature-flag-decorators"
|
||||
import { FlagRouter } from "../../../../utils/flag-router"
|
||||
import { DistributedTransaction } from "../../../../utils/transaction"
|
||||
import { validator } from "../../../../utils/validator"
|
||||
import { IInventoryService } from "../../../../interfaces"
|
||||
|
||||
import {
|
||||
createVariantTransaction,
|
||||
revertVariantTransaction,
|
||||
} from "./transaction/create-product-variant"
|
||||
import { DistributedTransaction } from "../../../../utils/transaction"
|
||||
import { Logger } from "../../../../types/global"
|
||||
import { FlagRouter } from "../../../../utils/flag-router"
|
||||
|
||||
/**
|
||||
* @oas [post] /admin/products
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { IInventoryService } from "@medusajs/types"
|
||||
import { Type } from "class-transformer"
|
||||
import {
|
||||
IsArray,
|
||||
IsBoolean,
|
||||
@@ -7,24 +9,19 @@ import {
|
||||
IsString,
|
||||
ValidateNested,
|
||||
} from "class-validator"
|
||||
import { Type } from "class-transformer"
|
||||
import { EntityManager } from "typeorm"
|
||||
import { defaultAdminProductFields, defaultAdminProductRelations } from "."
|
||||
import {
|
||||
PricingService,
|
||||
ProductService,
|
||||
ProductVariantInventoryService,
|
||||
ProductVariantService,
|
||||
} from "../../../../services"
|
||||
import { defaultAdminProductFields, defaultAdminProductRelations } from "."
|
||||
|
||||
import { IInventoryService } from "../../../../interfaces"
|
||||
import {
|
||||
CreateProductVariantInput,
|
||||
ProductVariantPricesCreateReq,
|
||||
} from "../../../../types/product-variant"
|
||||
import { validator } from "../../../../utils/validator"
|
||||
|
||||
import { EntityManager } from "typeorm"
|
||||
|
||||
import { createVariantTransaction } from "./transaction/create-product-variant"
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
import { MedusaError } from "medusa-core-utils"
|
||||
import { IInventoryService, InventoryItemDTO } from "@medusajs/types"
|
||||
import { MedusaError } from "@medusajs/utils"
|
||||
import { EntityManager } from "typeorm"
|
||||
import { ulid } from "ulid"
|
||||
import { IInventoryService } from "../../../../../interfaces"
|
||||
import { ProductVariant } from "../../../../../models"
|
||||
import {
|
||||
ProductVariantInventoryService,
|
||||
ProductVariantService,
|
||||
} from "../../../../../services"
|
||||
import { InventoryItemDTO } from "../../../../../types/inventory"
|
||||
import { CreateProductVariantInput } from "../../../../../types/product-variant"
|
||||
import {
|
||||
DistributedTransaction,
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
import { IInventoryService } from "@medusajs/types"
|
||||
import { MedusaError } from "@medusajs/utils"
|
||||
import { Type } from "class-transformer"
|
||||
import {
|
||||
IsArray,
|
||||
IsBoolean,
|
||||
@@ -11,38 +14,34 @@ import {
|
||||
ValidateIf,
|
||||
ValidateNested,
|
||||
} from "class-validator"
|
||||
import { EntityManager } from "typeorm"
|
||||
import { defaultAdminProductFields, defaultAdminProductRelations } from "."
|
||||
import SalesChannelFeatureFlag from "../../../../loaders/feature-flags/sales-channels"
|
||||
import { ProductStatus } from "../../../../models"
|
||||
import {
|
||||
PricingService,
|
||||
ProductService,
|
||||
ProductVariantInventoryService,
|
||||
ProductVariantService,
|
||||
} from "../../../../services"
|
||||
import { Logger } from "../../../../types/global"
|
||||
import {
|
||||
ProductProductCategoryReq,
|
||||
ProductSalesChannelReq,
|
||||
ProductTagReq,
|
||||
ProductTypeReq,
|
||||
} from "../../../../types/product"
|
||||
|
||||
import { Type } from "class-transformer"
|
||||
import { EntityManager } from "typeorm"
|
||||
import SalesChannelFeatureFlag from "../../../../loaders/feature-flags/sales-channels"
|
||||
import { ProductStatus } from "../../../../models"
|
||||
import {
|
||||
CreateProductVariantInput,
|
||||
ProductVariantPricesUpdateReq,
|
||||
} from "../../../../types/product-variant"
|
||||
import { FeatureFlagDecorators } from "../../../../utils/feature-flag-decorators"
|
||||
import { validator } from "../../../../utils/validator"
|
||||
import { MedusaError } from "medusa-core-utils"
|
||||
import { DistributedTransaction } from "../../../../utils/transaction"
|
||||
import { validator } from "../../../../utils/validator"
|
||||
import {
|
||||
createVariantTransaction,
|
||||
revertVariantTransaction,
|
||||
} from "./transaction/create-product-variant"
|
||||
import { IInventoryService } from "../../../../interfaces"
|
||||
import { Logger } from "../../../../types/global"
|
||||
|
||||
/**
|
||||
* @oas [post] /admin/products/{id}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { IInventoryService } from "@medusajs/types"
|
||||
import { isDefined } from "@medusajs/utils"
|
||||
import { IsNumber, IsObject, IsOptional, IsString } from "class-validator"
|
||||
import { isDefined } from "medusa-core-utils"
|
||||
import { IInventoryService } from "../../../../interfaces"
|
||||
import { validateUpdateReservationQuantity } from "./utils/validate-reservation-quantity"
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { IInventoryService } from "@medusajs/types"
|
||||
import { EntityManager } from "typeorm"
|
||||
import { IInventoryService } from "../../../../interfaces"
|
||||
|
||||
/**
|
||||
* @oas [delete] /admin/reservations/{id}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { MedusaError } from "medusa-core-utils"
|
||||
import { IInventoryService } from "../../../../interfaces"
|
||||
import { IInventoryService } from "@medusajs/types"
|
||||
import { MedusaError } from "@medusajs/utils"
|
||||
|
||||
/**
|
||||
* @oas [get] /admin/reservations/{id}
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
import { ReservationItemDTO } from "@medusajs/types"
|
||||
import { Router } from "express"
|
||||
import { ReservationItemDTO } from "../../../.."
|
||||
import { DeleteResponse, PaginatedResponse } from "../../../../types/common"
|
||||
import middlewares, {
|
||||
transformBody,
|
||||
transformQuery,
|
||||
} from "../../../middlewares"
|
||||
import "reflect-metadata"
|
||||
import { AdminPostReservationsReq } from "./create-reservation"
|
||||
import { AdminPostReservationsReservationReq } from "./update-reservation"
|
||||
import { checkRegisteredModules } from "../../../middlewares/check-registered-modules"
|
||||
import { AdminPostReservationsReq } from "./create-reservation"
|
||||
import { AdminGetReservationsParams } from "./list-reservations"
|
||||
import { AdminPostReservationsReservationReq } from "./update-reservation"
|
||||
|
||||
const route = Router()
|
||||
|
||||
@@ -133,5 +132,5 @@ export type AdminReservationsDeleteRes = DeleteResponse
|
||||
export * from "./create-reservation"
|
||||
export * from "./delete-reservation"
|
||||
export * from "./get-reservation"
|
||||
export * from "./update-reservation"
|
||||
export * from "./list-reservations"
|
||||
export * from "./update-reservation"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { IInventoryService } from "@medusajs/types"
|
||||
import { Type } from "class-transformer"
|
||||
import { IsArray, IsOptional, IsString, ValidateNested } from "class-validator"
|
||||
import { Request, Response } from "express"
|
||||
import { IInventoryService } from "../../../../interfaces"
|
||||
import {
|
||||
extendedFindParamsMixin,
|
||||
NumericalComparisonOperator,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { IInventoryService } from "@medusajs/types"
|
||||
import { isDefined } from "@medusajs/utils"
|
||||
import { IsNumber, IsObject, IsOptional, IsString } from "class-validator"
|
||||
import { isDefined, MedusaError } from "medusa-core-utils"
|
||||
import { EntityManager } from "typeorm"
|
||||
import { IInventoryService } from "../../../../interfaces"
|
||||
import { LineItemService } from "../../../../services"
|
||||
import { validateUpdateReservationQuantity } from "./utils/validate-reservation-quantity"
|
||||
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
import { MedusaError } from "medusa-core-utils"
|
||||
import { IInventoryService } from "../../../../../interfaces"
|
||||
import { IInventoryService } from "@medusajs/types"
|
||||
import { MedusaError } from "@medusajs/utils"
|
||||
import { LineItemService } from "../../../../../services"
|
||||
|
||||
export const validateUpdateReservationQuantity = async (
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { Request, Response } from "express"
|
||||
import { IStockLocationService } from "@medusajs/types"
|
||||
import { Type } from "class-transformer"
|
||||
import { IsObject, IsOptional, IsString, ValidateNested } from "class-validator"
|
||||
|
||||
import { IStockLocationService } from "../../../../interfaces"
|
||||
import { Request, Response } from "express"
|
||||
import { FindParams } from "../../../../types/common"
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
import { IInventoryService, IStockLocationService } from "@medusajs/types"
|
||||
import { EntityManager } from "typeorm"
|
||||
import {
|
||||
IInventoryService,
|
||||
IStockLocationService,
|
||||
} from "../../../../interfaces"
|
||||
import { SalesChannelLocationService } from "../../../../services"
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { IStockLocationService } from "../../../../interfaces"
|
||||
import { IStockLocationService } from "@medusajs/types"
|
||||
import { Request, Response } from "express"
|
||||
import { FindParams } from "../../../../types/common"
|
||||
import { joinSalesChannels } from "./utils/join-sales-channels"
|
||||
import {
|
||||
SalesChannelLocationService,
|
||||
SalesChannelService,
|
||||
} from "../../../../services"
|
||||
import { FindParams } from "../../../../types/common"
|
||||
import { joinSalesChannels } from "./utils/join-sales-channels"
|
||||
|
||||
/**
|
||||
* @oas [get] /admin/stock-locations/{id}
|
||||
|
||||
@@ -1,25 +1,24 @@
|
||||
import { Router } from "express"
|
||||
import "reflect-metadata"
|
||||
import { DeleteResponse, PaginatedResponse } from "../../../../types/common"
|
||||
import {
|
||||
StockLocationDTO,
|
||||
StockLocationExpandedDTO,
|
||||
} from "../../../../types/stock-location"
|
||||
DeleteResponse,
|
||||
PaginatedResponse,
|
||||
StockLocationTypes,
|
||||
} from "@medusajs/types"
|
||||
import { Router } from "express"
|
||||
import middlewares, {
|
||||
transformBody,
|
||||
transformQuery,
|
||||
} from "../../../middlewares"
|
||||
import { AdminGetStockLocationsParams } from "./list-stock-locations"
|
||||
import { AdminGetStockLocationsLocationParams } from "./get-stock-location"
|
||||
import {
|
||||
AdminPostStockLocationsLocationParams,
|
||||
AdminPostStockLocationsLocationReq,
|
||||
} from "./update-stock-location"
|
||||
import { checkRegisteredModules } from "../../../middlewares/check-registered-modules"
|
||||
import {
|
||||
AdminPostStockLocationsParams,
|
||||
AdminPostStockLocationsReq,
|
||||
} from "./create-stock-location"
|
||||
import { checkRegisteredModules } from "../../../middlewares/check-registered-modules"
|
||||
import { AdminGetStockLocationsLocationParams } from "./get-stock-location"
|
||||
import { AdminGetStockLocationsParams } from "./list-stock-locations"
|
||||
import {
|
||||
AdminPostStockLocationsLocationParams,
|
||||
AdminPostStockLocationsLocationReq,
|
||||
} from "./update-stock-location"
|
||||
|
||||
const route = Router()
|
||||
|
||||
@@ -82,14 +81,9 @@ export default (app) => {
|
||||
return app
|
||||
}
|
||||
|
||||
export const defaultAdminStockLocationFields: (keyof StockLocationDTO)[] = [
|
||||
"id",
|
||||
"name",
|
||||
"address_id",
|
||||
"metadata",
|
||||
"created_at",
|
||||
"updated_at",
|
||||
]
|
||||
// eslint-disable-next-line max-len
|
||||
export const defaultAdminStockLocationFields: (keyof StockLocationTypes.StockLocationDTO)[] =
|
||||
["id", "name", "address_id", "metadata", "created_at", "updated_at"]
|
||||
|
||||
export const defaultAdminStockLocationRelations = []
|
||||
|
||||
@@ -125,7 +119,7 @@ export type AdminStockLocationsDeleteRes = DeleteResponse
|
||||
* $ref: "#/components/schemas/StockLocationExpandedDTO"
|
||||
*/
|
||||
export type AdminStockLocationsRes = {
|
||||
stock_location: StockLocationExpandedDTO
|
||||
stock_location: StockLocationTypes.StockLocationExpandedDTO
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -152,10 +146,10 @@ export type AdminStockLocationsRes = {
|
||||
* description: The number of items per page
|
||||
*/
|
||||
export type AdminStockLocationsListRes = PaginatedResponse & {
|
||||
stock_locations: StockLocationExpandedDTO[]
|
||||
stock_locations: StockLocationTypes.StockLocationExpandedDTO[]
|
||||
}
|
||||
|
||||
export * from "./list-stock-locations"
|
||||
export * from "./get-stock-location"
|
||||
export * from "./create-stock-location"
|
||||
export * from "./get-stock-location"
|
||||
export * from "./list-stock-locations"
|
||||
export * from "./update-stock-location"
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
import { IStockLocationService } from "@medusajs/types"
|
||||
import { IsOptional } from "class-validator"
|
||||
import { IsType } from "../../../../utils/validators/is-type"
|
||||
|
||||
import { IStockLocationService } from "../../../../interfaces"
|
||||
import { extendedFindParamsMixin } from "../../../../types/common"
|
||||
import { Request, Response } from "express"
|
||||
import {
|
||||
SalesChannelLocationService,
|
||||
SalesChannelService,
|
||||
} from "../../../../services"
|
||||
import { extendedFindParamsMixin } from "../../../../types/common"
|
||||
import { IsType } from "../../../../utils/validators/is-type"
|
||||
import { joinSalesChannels } from "./utils/join-sales-channels"
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { Request, Response } from "express"
|
||||
import { IStockLocationService } from "@medusajs/types"
|
||||
import { Type } from "class-transformer"
|
||||
import { IsObject, IsOptional, IsString, ValidateNested } from "class-validator"
|
||||
|
||||
import { IStockLocationService } from "../../../../interfaces"
|
||||
import { Request, Response } from "express"
|
||||
import { FindParams } from "../../../../types/common"
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
import { StockLocationDTO, StockLocationExpandedDTO } from "@medusajs/types"
|
||||
import {
|
||||
SalesChannelLocationService,
|
||||
SalesChannelService,
|
||||
} from "../../../../../services"
|
||||
import {
|
||||
StockLocationDTO,
|
||||
StockLocationExpandedDTO,
|
||||
} from "../../../../../types/stock-location"
|
||||
|
||||
const joinSalesChannels = async (
|
||||
locations: StockLocationDTO[],
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { ModulesHelper } from "@medusajs/modules-sdk"
|
||||
import { defaultRelationsExtended } from "."
|
||||
import {
|
||||
FulfillmentProviderService,
|
||||
PaymentProviderService,
|
||||
@@ -5,8 +7,6 @@ import {
|
||||
} from "../../../../services"
|
||||
import { ExtendedStoreDTO } from "../../../../types/store"
|
||||
import { FlagRouter } from "../../../../utils/flag-router"
|
||||
import { ModulesHelper } from "@medusajs/modules-sdk"
|
||||
import { defaultRelationsExtended } from "."
|
||||
|
||||
/**
|
||||
* @oas [get] /admin/store
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import {
|
||||
IInventoryService,
|
||||
InventoryItemDTO,
|
||||
InventoryLevelDTO,
|
||||
} from "../../../../types/inventory"
|
||||
import ProductVariantInventoryService from "../../../../services/product-variant-inventory"
|
||||
} from "@medusajs/types"
|
||||
import { SalesChannel } from "../../../../models"
|
||||
import {
|
||||
SalesChannelLocationService,
|
||||
SalesChannelService,
|
||||
} from "../../../../services"
|
||||
import { SalesChannel } from "../../../../models"
|
||||
import { IInventoryService } from "../../../../interfaces"
|
||||
import ProductVariantService from "../../../../services/product-variant"
|
||||
import ProductVariantInventoryService from "../../../../services/product-variant-inventory"
|
||||
import { joinLevels } from "../inventory-items/utils/join-levels"
|
||||
|
||||
/**
|
||||
@@ -126,6 +126,7 @@ export default async (req, res) => {
|
||||
}
|
||||
|
||||
const quantity =
|
||||
// eslint-disable-next-line max-len
|
||||
await productVariantInventoryService.getVariantQuantityFromVariantInventoryItems(
|
||||
variantInventoryItems,
|
||||
channel.id
|
||||
|
||||
Reference in New Issue
Block a user