feat(core-flows,dashboard,js-sdk,medusa,types): support Fulfillment Options (#10622)
**What** - add a list point for fetching fulfillment options for a provider - add FO support on SO create & update on dashboard - pass `cart` and `stockLocation` to `validateFufillmentData` context --- CLOSES CMRC-789 CLOSES CMRC-790
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import {
|
||||
AdminFulfillmentProviderOption,
|
||||
HttpTypes,
|
||||
} from "@medusajs/framework/types"
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "@medusajs/framework/http"
|
||||
|
||||
export const GET = async (
|
||||
req: AuthenticatedMedusaRequest,
|
||||
res: MedusaResponse<HttpTypes.AdminFulfillmentProviderOptionsListResponse>
|
||||
) => {
|
||||
const fulfillmentProviderService = req.scope.resolve(Modules.FULFILLMENT)
|
||||
|
||||
const fulfillmentOptions =
|
||||
await fulfillmentProviderService.retrieveFulfillmentOptions(req.params.id)
|
||||
|
||||
res.json({
|
||||
fulfillment_options:
|
||||
fulfillmentOptions as unknown as AdminFulfillmentProviderOption[],
|
||||
count: fulfillmentOptions.length,
|
||||
limit: fulfillmentOptions.length,
|
||||
offset: 0,
|
||||
})
|
||||
}
|
||||
@@ -20,4 +20,9 @@ export const adminFulfillmentProvidersRoutesMiddlewares: MiddlewareRoute[] = [
|
||||
}),
|
||||
],
|
||||
},
|
||||
{
|
||||
method: ["GET"],
|
||||
matcher: "/admin/fulfillment-providers/:id/options",
|
||||
middlewares: [],
|
||||
},
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user