feat(medusa,types): add fulfillment provider list api (#7124)

* feat(medusa,types): add fulfillment provider list api

* chore: remove timestamps
This commit is contained in:
Riqwan Thamir
2024-04-22 19:35:33 +02:00
committed by GitHub
parent 0df523594f
commit 38c971f111
11 changed files with 178 additions and 2 deletions
@@ -1,3 +1,4 @@
import { BaseFilterable, OperatorMap } from "../../dal"
import { ShippingOptionDTO } from "./shipping-option"
/**
@@ -39,3 +40,14 @@ export interface FulfillmentProviderDTO {
*/
deleted_at: Date | null
}
/**
* The filters to apply on the retrieved fulfillment providers.
*/
export interface FilterableFulfillmentProviderProps
extends BaseFilterable<FilterableFulfillmentProviderProps> {
/**
* The IDs to filter the provider by.
*/
id?: string | string[] | OperatorMap<string | string[]>
}
+27
View File
@@ -4,6 +4,7 @@ import { IModuleService } from "../modules-sdk"
import { Context } from "../shared-context"
import {
FilterableFulfillmentProps,
FilterableFulfillmentProviderProps,
FilterableFulfillmentSetProps,
FilterableGeoZoneProps,
FilterableServiceZoneProps,
@@ -13,6 +14,7 @@ import {
FilterableShippingOptionTypeProps,
FilterableShippingProfileProps,
FulfillmentDTO,
FulfillmentProviderDTO,
FulfillmentSetDTO,
GeoZoneDTO,
ServiceZoneDTO,
@@ -2498,4 +2500,29 @@ export interface IFulfillmentModuleService extends IModuleService {
shippingOptionId: string,
context: Record<string, unknown>
): Promise<boolean>
/**
* This method retrieves a paginated list of fulfillment providers based on optional filters and configuration.
*
* @param {FilterableFulfillmentProviderProps} filters - The filters to apply on the retrieved fulfillment providers.
* @param {FindConfig<FulfillmentProviderDTO>} config - The configurations determining how the fulfillment provider is retrieved. Its properties, such as `select` or `relations`, accept the
* attributes or relations associated with a fulfillment provider.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<FulfillmentProviderDTO[]>} The list of fulfillment providers.
*
* @example
* To retrieve a list of fulfillment providers using their IDs:
*
* ```ts
* const providers = await fulfillmentModuleService.listFulfillmentProviders({
* id: ["sepro_123", "sepro_321"],
* })
* ```
*
*/
listFulfillmentProviders(
filters?: FilterableFulfillmentProviderProps,
config?: FindConfig<FulfillmentProviderDTO>,
sharedContext?: Context
): Promise<FulfillmentProviderDTO[]>
}