Feat(medusa, core-flows, types): add reservation endpoints (#7018)

* add reservation endpoints

* add changeset
This commit is contained in:
Philip Korsholm authored and GitHub committed 2024-04-09 18:40:00 +02:00
1 parent 78f603e4f1
commit f175cac4af
24 files changed
+1204 -1

No files matched your search

@@ -1,4 +1,5 @@
import { RestoreReturn, SoftDeleteReturn } from "../dal"
import { Context } from "../shared-context"
import { FindConfig } from "../common"
import { IModuleService } from "../modules-sdk"
@@ -749,6 +750,47 @@ export interface IInventoryServiceNext extends IModuleService {
context?: Context
): Promise<void>
/**
* This method soft deletes reservations by their IDs.
*
* @param {string[]} inventoryLevelIds - The reservations' IDs.
* @param {SoftDeleteReturn<TReturnableLinkableKeys>} config - An object that is used to specify an entity's related entities that should be soft-deleted when the main entity is soft-deleted.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<void | Record<string, string[]>>} An object that includes the IDs of related records that were also soft deleted.
* If there are no related records, the promise resolves to `void`.
*
* @example
* await inventoryModuleService.softDeleteReservationItems([
* "ilev_123",
* ])
*/
softDeleteReservationItems<TReturnableLinkableKeys extends string = string>(
ReservationItemIds: string[],
config?: SoftDeleteReturn<TReturnableLinkableKeys>,
sharedContext?: Context
): Promise<Record<string, string[]> | void>
/**
* This method restores soft deleted reservations by their IDs.
*
* @param {string[]} ReservationItemIds - The reservations' IDs.
* @param {RestoreReturn<TReturnableLinkableKeys>} config - Configurations determining which relations to restore along with each of the reservation. You can pass to its `returnLinkableKeys`
* property any of the reservation's relation attribute names, such as `{type relation name}`.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<void | Record<string, string[]>>} An object that includes the IDs of related records that were restored.
* If there are no related records restored, the promise resolves to `void`.
*
* @example
* await inventoryModuleService.restoreReservationItems([
* "ilev_123",
* ])
*/
restoreReservationItems<TReturnableLinkableKeys extends string = string>(
ReservationItemIds: string[],
config?: RestoreReturn<TReturnableLinkableKeys>,
sharedContext?: Context
): Promise<Record<string, string[]> | void>
/**
* This method deletes inventory items by their IDs.
*
+1
View File
@@ -7,3 +7,4 @@ export * as UserWorkflow from "./user"
export * as RegionWorkflow from "./region"
export * as InviteWorkflow from "./invite"
export * as FulfillmentWorkflow from "./fulfillment"
export * as ReservationWorkflow from "./reservation"
@@ -0,0 +1,8 @@
import { InventoryNext } from "../../inventory"
export interface CreateReservationsWorkflowInput {
reservations: InventoryNext.CreateReservationItemInput[]
}
export type CreateReservationsWorkflowOutput =
InventoryNext.ReservationItemDTO[]
@@ -0,0 +1,2 @@
export * from "./create-reservations"
export * from "./update-reservations"
@@ -0,0 +1,8 @@
import { InventoryNext } from "../../inventory"
export interface UpdateReservationsWorkflowInput {
updates: InventoryNext.UpdateReservationItemInput[]
}
export type UpdateReservationsWorkflowOutput =
InventoryNext.ReservationItemDTO[]