chore(types, medusa): [1/n] add missing query type arguments (#8877)

Add missing type arguments in listing requests.

1/n
This commit is contained in:
Shahed Nasser
2024-08-30 07:35:18 +00:00
committed by GitHub
parent bab6ad4c55
commit 170429a9b3
20 changed files with 43 additions and 27 deletions
@@ -1,3 +1,4 @@
export * from "./entitites" export * from "./entitites"
export * from "./payloads" export * from "./payloads"
export * from "./queries"
export * from "./responses" export * from "./responses"
@@ -0,0 +1,6 @@
export interface AdminGetFulfillmentProvidersParams {
id?: string | string[]
stock_location_id?: string | string[]
is_enabled?: boolean
q?: string
}
@@ -1,7 +1,7 @@
import { FindParams } from "../../common" import { FindParams } from "../../common"
import { OperatorMap } from "../../../dal" import { BaseFilterable, OperatorMap } from "../../../dal"
export interface AdminInventoryItemParams extends FindParams { export interface AdminInventoryItemParams extends FindParams, BaseFilterable<AdminInventoryItemParams> {
id?: string | string[] id?: string | string[]
q?: string q?: string
sku?: string | string[] sku?: string | string[]
@@ -1,3 +1,4 @@
export * from "./entities" export * from "./entities"
export * from "./payloads" export * from "./payloads"
export * from "./queries"
export * from "./responses" export * from "./responses"
@@ -0,0 +1,11 @@
import { BaseFilterable, OperatorMap } from "../../../dal"
import { FindParams } from "../../common"
export interface AdminGetInvitesParams extends FindParams, BaseFilterable<AdminGetInvitesParams> {
q?: string
id?: string | string[]
email?: string | string[]
created_at?: OperatorMap<string>
updated_at?: OperatorMap<string>
deleted_at?: OperatorMap<string>
}
@@ -1,3 +1,7 @@
import { BaseOrderFilters } from "../common"; import { BaseFilterable } from "../../../dal";
import { FindParams } from "../../common";
export interface AdminOrderFilters extends BaseOrderFilters {} export interface AdminOrderFilters extends FindParams, BaseFilterable<AdminOrderFilters> {
id?: string[] | string
name?: string[] | string
}
@@ -11,7 +11,7 @@ import { AdminCreateApiKeyType } from "./validators"
import { HttpTypes } from "@medusajs/types" import { HttpTypes } from "@medusajs/types"
export const GET = async ( export const GET = async (
req: AuthenticatedMedusaRequest, req: AuthenticatedMedusaRequest<HttpTypes.AdminGetApiKeysParams>,
res: MedusaResponse<HttpTypes.AdminApiKeyListResponse> res: MedusaResponse<HttpTypes.AdminApiKeyListResponse>
) => { ) => {
const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY) const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)
@@ -12,7 +12,7 @@ import { refetchCampaign } from "./helpers"
import { AdditionalData, HttpTypes } from "@medusajs/types" import { AdditionalData, HttpTypes } from "@medusajs/types"
export const GET = async ( export const GET = async (
req: AuthenticatedMedusaRequest, req: AuthenticatedMedusaRequest<HttpTypes.AdminGetCampaignParams>,
res: MedusaResponse<HttpTypes.AdminCampaignListResponse> res: MedusaResponse<HttpTypes.AdminCampaignListResponse>
) => { ) => {
const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY) const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)
@@ -13,7 +13,7 @@ import {
import { AdminPostOrderClaimsReqSchemaType } from "./validators" import { AdminPostOrderClaimsReqSchemaType } from "./validators"
export const GET = async ( export const GET = async (
req: AuthenticatedMedusaRequest, req: AuthenticatedMedusaRequest<HttpTypes.AdminClaimListParams>,
res: MedusaResponse<HttpTypes.AdminClaimListResponse> res: MedusaResponse<HttpTypes.AdminClaimListResponse>
) => { ) => {
const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY) const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)
@@ -13,7 +13,7 @@ import { refetchCollection } from "./helpers"
import { HttpTypes } from "@medusajs/types" import { HttpTypes } from "@medusajs/types"
export const GET = async ( export const GET = async (
req: AuthenticatedMedusaRequest, req: AuthenticatedMedusaRequest<HttpTypes.AdminCollectionListParams>,
res: MedusaResponse<HttpTypes.AdminCollectionListResponse> res: MedusaResponse<HttpTypes.AdminCollectionListResponse>
) => { ) => {
const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY) const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)
@@ -6,7 +6,7 @@ import { MedusaRequest, MedusaResponse } from "../../../types/routing"
import { HttpTypes } from "@medusajs/types" import { HttpTypes } from "@medusajs/types"
export const GET = async ( export const GET = async (
req: MedusaRequest, req: MedusaRequest<HttpTypes.AdminCurrencyListParams>,
res: MedusaResponse<HttpTypes.AdminCurrencyListResponse> res: MedusaResponse<HttpTypes.AdminCurrencyListResponse>
) => { ) => {
const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY) const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)
@@ -12,7 +12,7 @@ import { refetchCustomerGroup } from "./helpers"
import { HttpTypes } from "@medusajs/types" import { HttpTypes } from "@medusajs/types"
export const GET = async ( export const GET = async (
req: AuthenticatedMedusaRequest, req: AuthenticatedMedusaRequest<HttpTypes.AdminGetCustomerGroupsParams>,
res: MedusaResponse<HttpTypes.AdminCustomerGroupListResponse> res: MedusaResponse<HttpTypes.AdminCustomerGroupListResponse>
) => { ) => {
const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY) const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)
@@ -13,7 +13,7 @@ import { refetchCustomer } from "./helpers"
import { AdminCreateCustomerType } from "./validators" import { AdminCreateCustomerType } from "./validators"
export const GET = async ( export const GET = async (
req: AuthenticatedMedusaRequest, req: AuthenticatedMedusaRequest<HttpTypes.AdminCustomerFilters>,
res: MedusaResponse<HttpTypes.AdminCustomerListResponse> res: MedusaResponse<HttpTypes.AdminCustomerListResponse>
) => { ) => {
const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY) const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)
@@ -14,7 +14,7 @@ import { refetchOrder } from "./helpers"
import { AdditionalData, CreateOrderDTO, HttpTypes } from "@medusajs/types" import { AdditionalData, CreateOrderDTO, HttpTypes } from "@medusajs/types"
export const GET = async ( export const GET = async (
req: MedusaRequest, req: MedusaRequest<HttpTypes.AdminOrderFilters>,
res: MedusaResponse<HttpTypes.AdminDraftOrderListResponse> res: MedusaResponse<HttpTypes.AdminDraftOrderListResponse>
) => { ) => {
const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY) const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)
@@ -13,7 +13,7 @@ import {
import { AdminPostOrderExchangesReqSchemaType } from "./validators" import { AdminPostOrderExchangesReqSchemaType } from "./validators"
export const GET = async ( export const GET = async (
req: AuthenticatedMedusaRequest, req: AuthenticatedMedusaRequest<HttpTypes.AdminExchangeListParams>,
res: MedusaResponse<HttpTypes.AdminExchangeListResponse> res: MedusaResponse<HttpTypes.AdminExchangeListResponse>
) => { ) => {
const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY) const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)
@@ -6,11 +6,10 @@ import {
AuthenticatedMedusaRequest, AuthenticatedMedusaRequest,
MedusaResponse, MedusaResponse,
} from "../../../types/routing" } from "../../../types/routing"
import { AdminFulfillmentProvidersParamsType } from "./validators"
import { HttpTypes } from "@medusajs/types" import { HttpTypes } from "@medusajs/types"
export const GET = async ( export const GET = async (
req: AuthenticatedMedusaRequest<AdminFulfillmentProvidersParamsType>, req: AuthenticatedMedusaRequest<HttpTypes.AdminGetFulfillmentProvidersParams>,
res: MedusaResponse<HttpTypes.AdminFulfillmentProviderListResponse> res: MedusaResponse<HttpTypes.AdminFulfillmentProviderListResponse>
) => { ) => {
const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY) const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)
@@ -8,15 +8,11 @@ import {
} from "@medusajs/utils" } from "@medusajs/utils"
import { createInventoryItemsWorkflow } from "@medusajs/core-flows" import { createInventoryItemsWorkflow } from "@medusajs/core-flows"
import {
AdminCreateInventoryItemType,
AdminGetInventoryItemsParamsType,
} from "./validators"
import { refetchInventoryItem } from "./helpers" import { refetchInventoryItem } from "./helpers"
import { HttpTypes } from "@medusajs/types" import { HttpTypes } from "@medusajs/types"
export const POST = async ( export const POST = async (
req: AuthenticatedMedusaRequest<AdminCreateInventoryItemType>, req: AuthenticatedMedusaRequest<HttpTypes.AdminCreateInventoryItem>,
res: MedusaResponse<HttpTypes.AdminInventoryItemResponse> res: MedusaResponse<HttpTypes.AdminInventoryItemResponse>
) => { ) => {
const { result } = await createInventoryItemsWorkflow(req.scope).run({ const { result } = await createInventoryItemsWorkflow(req.scope).run({
@@ -33,7 +29,7 @@ export const POST = async (
} }
export const GET = async ( export const GET = async (
req: AuthenticatedMedusaRequest<AdminGetInventoryItemsParamsType>, req: AuthenticatedMedusaRequest<HttpTypes.AdminInventoryItemParams>,
res: MedusaResponse<HttpTypes.AdminInventoryItemListResponse> res: MedusaResponse<HttpTypes.AdminInventoryItemListResponse>
) => { ) => {
const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY) const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)
@@ -8,12 +8,11 @@ import {
} from "@medusajs/utils" } from "@medusajs/utils"
import { createInvitesWorkflow } from "@medusajs/core-flows" import { createInvitesWorkflow } from "@medusajs/core-flows"
import { AdminCreateInviteType, AdminGetInvitesParamsType } from "./validators"
import { refetchInvite } from "./helpers" import { refetchInvite } from "./helpers"
import { HttpTypes } from "@medusajs/types" import { HttpTypes } from "@medusajs/types"
export const GET = async ( export const GET = async (
req: AuthenticatedMedusaRequest<AdminGetInvitesParamsType>, req: AuthenticatedMedusaRequest<HttpTypes.AdminGetInvitesParams>,
res: MedusaResponse<HttpTypes.AdminInviteListResponse> res: MedusaResponse<HttpTypes.AdminInviteListResponse>
) => { ) => {
const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY) const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)
@@ -37,7 +36,7 @@ export const GET = async (
} }
export const POST = async ( export const POST = async (
req: AuthenticatedMedusaRequest<AdminCreateInviteType>, req: AuthenticatedMedusaRequest<HttpTypes.AdminCreateInvite>,
res: MedusaResponse<HttpTypes.AdminInviteResponse> res: MedusaResponse<HttpTypes.AdminInviteResponse>
) => { ) => {
const workflow = createInvitesWorkflow(req.scope) const workflow = createInvitesWorkflow(req.scope)
@@ -2,12 +2,11 @@ import {
AuthenticatedMedusaRequest, AuthenticatedMedusaRequest,
MedusaResponse, MedusaResponse,
} from "../../../types/routing" } from "../../../types/routing"
import { AdminGetNotificationsParamsType } from "./validators"
import { refetchEntities } from "../../utils/refetch-entity" import { refetchEntities } from "../../utils/refetch-entity"
import { HttpTypes } from "@medusajs/types" import { HttpTypes } from "@medusajs/types"
export const GET = async ( export const GET = async (
req: AuthenticatedMedusaRequest<AdminGetNotificationsParamsType>, req: AuthenticatedMedusaRequest<HttpTypes.AdminNotificationListParams>,
res: MedusaResponse<HttpTypes.AdminNotificationListResponse> res: MedusaResponse<HttpTypes.AdminNotificationListResponse>
) => { ) => {
const { rows: notifications, metadata } = await refetchEntities( const { rows: notifications, metadata } = await refetchEntities(
@@ -6,7 +6,7 @@ import {
} from "../../../types/routing" } from "../../../types/routing"
export const GET = async ( export const GET = async (
req: AuthenticatedMedusaRequest, req: AuthenticatedMedusaRequest<HttpTypes.AdminOrderFilters>,
res: MedusaResponse<HttpTypes.AdminOrderListResponse> res: MedusaResponse<HttpTypes.AdminOrderListResponse>
) => { ) => {
const variables = { const variables = {