chore: fixes to http and request types for payment and regions (#13831)

This commit is contained in:
Shahed Nasser
2025-10-28 11:09:51 +02:00
committed by GitHub
parent 64c5019b3b
commit a2b6ef36d9
12 changed files with 41 additions and 20 deletions

View File

@@ -38,7 +38,7 @@ export interface AdminCreatePriceList {
/** /**
* The price list's description. * The price list's description.
*/ */
description?: string | null description: string
/** /**
* The price list's start date. * The price list's start date.
*/ */
@@ -50,11 +50,11 @@ export interface AdminCreatePriceList {
/** /**
* The price list's status. * The price list's status.
*/ */
status: PriceListStatus status?: PriceListStatus
/** /**
* The price list's type. * The price list's type.
*/ */
type: PriceListType type?: PriceListType
/** /**
* The price list's rules. * The price list's rules.
*/ */

View File

@@ -1,5 +1,6 @@
import { FindParams } from "../../common";
import { BaseRegionCountryFilters, BaseRegionFilters } from "../common" import { BaseRegionCountryFilters, BaseRegionFilters } from "../common"
export interface StoreRegionFilters export interface StoreRegionFilters
extends Omit<BaseRegionFilters, "created_at" | "updated_at"> {} extends Omit<BaseRegionFilters, "created_at" | "updated_at">, FindParams {}
export interface StoreRegionCountryFilters extends BaseRegionCountryFilters {} export interface StoreRegionCountryFilters extends BaseRegionCountryFilters {}

View File

@@ -7,7 +7,7 @@ import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http"
import { HttpTypes } from "@medusajs/framework/types" import { HttpTypes } from "@medusajs/framework/types"
export const GET = async ( export const GET = async (
req: MedusaRequest, req: MedusaRequest<HttpTypes.AdminCurrencyParams>,
res: MedusaResponse<HttpTypes.AdminCurrencyResponse> res: MedusaResponse<HttpTypes.AdminCurrencyResponse>
) => { ) => {
const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY) const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)

View File

@@ -8,7 +8,10 @@ import {
import { fetchPriceList, fetchPriceListPriceIdsForProduct } from "../../helpers" import { fetchPriceList, fetchPriceListPriceIdsForProduct } from "../../helpers"
export const POST = async ( export const POST = async (
req: AuthenticatedMedusaRequest<HttpTypes.AdminLinkPriceListProducts>, req: AuthenticatedMedusaRequest<
HttpTypes.AdminLinkPriceListProducts,
HttpTypes.AdminPriceListParams
>,
res: MedusaResponse<HttpTypes.AdminPriceListResponse> res: MedusaResponse<HttpTypes.AdminPriceListResponse>
) => { ) => {
const id = req.params.id const id = req.params.id

View File

@@ -7,11 +7,10 @@ import {
MedusaResponse, MedusaResponse,
} from "@medusajs/framework/http" } from "@medusajs/framework/http"
import { fetchPriceList } from "../helpers" import { fetchPriceList } from "../helpers"
import { AdminUpdatePriceListType } from "../validators"
import { HttpTypes } from "@medusajs/framework/types" import { HttpTypes } from "@medusajs/framework/types"
export const GET = async ( export const GET = async (
req: AuthenticatedMedusaRequest, req: AuthenticatedMedusaRequest<HttpTypes.AdminPriceListParams>,
res: MedusaResponse<HttpTypes.AdminPriceListResponse> res: MedusaResponse<HttpTypes.AdminPriceListResponse>
) => { ) => {
const price_list = await fetchPriceList( const price_list = await fetchPriceList(
@@ -24,7 +23,10 @@ export const GET = async (
} }
export const POST = async ( export const POST = async (
req: AuthenticatedMedusaRequest<AdminUpdatePriceListType>, req: AuthenticatedMedusaRequest<
HttpTypes.AdminUpdatePriceList,
HttpTypes.AdminPriceListParams
>,
res: MedusaResponse<HttpTypes.AdminPriceListResponse> res: MedusaResponse<HttpTypes.AdminPriceListResponse>
) => { ) => {
const id = req.params.id const id = req.params.id

View File

@@ -8,7 +8,6 @@ import {
MedusaResponse, MedusaResponse,
} from "@medusajs/framework/http" } from "@medusajs/framework/http"
import { fetchPriceList, transformPriceList } from "./helpers" import { fetchPriceList, transformPriceList } from "./helpers"
import { AdminCreatePriceListType } from "./validators"
import { HttpTypes } from "@medusajs/framework/types" import { HttpTypes } from "@medusajs/framework/types"
export const GET = async ( export const GET = async (
@@ -37,7 +36,10 @@ export const GET = async (
} }
export const POST = async ( export const POST = async (
req: AuthenticatedMedusaRequest<AdminCreatePriceListType>, req: AuthenticatedMedusaRequest<
HttpTypes.AdminCreatePriceList,
HttpTypes.AdminPriceListListParams
>,
res: MedusaResponse<HttpTypes.AdminPriceListResponse> res: MedusaResponse<HttpTypes.AdminPriceListResponse>
) => { ) => {
const workflow = createPriceListsWorkflow(req.scope) const workflow = createPriceListsWorkflow(req.scope)

View File

@@ -11,7 +11,7 @@ import {
} from "@medusajs/framework/http" } from "@medusajs/framework/http"
export const GET = async ( export const GET = async (
req: AuthenticatedMedusaRequest, req: AuthenticatedMedusaRequest<HttpTypes.AdminPricePreferenceParams>,
res: MedusaResponse<HttpTypes.AdminPricePreferenceResponse> res: MedusaResponse<HttpTypes.AdminPricePreferenceResponse>
) => { ) => {
const price_preference = await refetchEntity({ const price_preference = await refetchEntity({
@@ -25,7 +25,10 @@ export const GET = async (
} }
export const POST = async ( export const POST = async (
req: AuthenticatedMedusaRequest<HttpTypes.AdminUpdatePricePreference>, req: AuthenticatedMedusaRequest<
HttpTypes.AdminUpdatePricePreference,
HttpTypes.AdminPricePreferenceParams
>,
res: MedusaResponse<HttpTypes.AdminPricePreferenceResponse> res: MedusaResponse<HttpTypes.AdminPricePreferenceResponse>
) => { ) => {
const id = req.params.id const id = req.params.id

View File

@@ -28,7 +28,10 @@ export const GET = async (
} }
export const POST = async ( export const POST = async (
req: AuthenticatedMedusaRequest<HttpTypes.AdminCreatePricePreference>, req: AuthenticatedMedusaRequest<
HttpTypes.AdminCreatePricePreference,
HttpTypes.AdminPricePreferenceParams
>,
res: MedusaResponse<HttpTypes.AdminPricePreferenceResponse> res: MedusaResponse<HttpTypes.AdminPricePreferenceResponse>
) => { ) => {
const workflow = createPricePreferencesWorkflow(req.scope) const workflow = createPricePreferencesWorkflow(req.scope)

View File

@@ -8,11 +8,12 @@ import {
MedusaResponse, MedusaResponse,
} from "@medusajs/framework/http" } from "@medusajs/framework/http"
import { refetchRegion } from "../helpers" import { refetchRegion } from "../helpers"
import { AdminGetRegionParamsType, AdminUpdateRegionType } from "../validators"
import { HttpTypes } from "@medusajs/framework/types" import { HttpTypes } from "@medusajs/framework/types"
export const GET = async ( export const GET = async (
req: AuthenticatedMedusaRequest<AdminGetRegionParamsType>, req: AuthenticatedMedusaRequest<
HttpTypes.SelectParams
>,
res: MedusaResponse<HttpTypes.AdminRegionResponse> res: MedusaResponse<HttpTypes.AdminRegionResponse>
) => { ) => {
const region = await refetchRegion( const region = await refetchRegion(
@@ -32,7 +33,10 @@ export const GET = async (
} }
export const POST = async ( export const POST = async (
req: AuthenticatedMedusaRequest<AdminUpdateRegionType>, req: AuthenticatedMedusaRequest<
HttpTypes.AdminUpdateRegion,
HttpTypes.SelectParams
>,
res: MedusaResponse<HttpTypes.AdminRegionResponse> res: MedusaResponse<HttpTypes.AdminRegionResponse>
) => { ) => {
const existingRegion = await refetchRegion(req.params.id, req.scope, ["id"]) const existingRegion = await refetchRegion(req.params.id, req.scope, ["id"])

View File

@@ -36,7 +36,10 @@ export const GET = async (
} }
export const POST = async ( export const POST = async (
req: AuthenticatedMedusaRequest<HttpTypes.AdminCreateRegion>, req: AuthenticatedMedusaRequest<
HttpTypes.AdminCreateRegion,
HttpTypes.SelectParams
>,
res: MedusaResponse<HttpTypes.AdminRegionResponse> res: MedusaResponse<HttpTypes.AdminRegionResponse>
) => { ) => {
const input = [req.validatedBody] const input = [req.validatedBody]

View File

@@ -7,7 +7,7 @@ import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http"
import { HttpTypes } from "@medusajs/framework/types" import { HttpTypes } from "@medusajs/framework/types"
export const GET = async ( export const GET = async (
req: MedusaRequest, req: MedusaRequest<HttpTypes.SelectParams>,
res: MedusaResponse<HttpTypes.StoreCurrencyResponse> res: MedusaResponse<HttpTypes.StoreCurrencyResponse>
) => { ) => {
const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY) const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)

View File

@@ -7,7 +7,7 @@ import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http"
import { HttpTypes } from "@medusajs/framework/types" import { HttpTypes } from "@medusajs/framework/types"
export const GET = async ( export const GET = async (
req: MedusaRequest, req: MedusaRequest<HttpTypes.SelectParams>,
res: MedusaResponse<HttpTypes.StoreRegionResponse> res: MedusaResponse<HttpTypes.StoreRegionResponse>
) => { ) => {
const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY) const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)