feat: deprecate remoteQueryConfig in favor of queryConfig (#10773)
Fixes: FRMW-2783
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
---
|
||||
"@medusajs/medusa": patch
|
||||
"@medusajs/framework": patch
|
||||
"@medusajs/types": patch
|
||||
---
|
||||
|
||||
feat: deprecate remoteQueryConfig in favor of queryConfig
|
||||
@@ -107,7 +107,7 @@ describe("validateAndTransformQuery", () => {
|
||||
],
|
||||
order: transformedOrder,
|
||||
})
|
||||
expect(mockRequest.remoteQueryConfig).toEqual({
|
||||
expect(mockRequest.queryConfig).toEqual({
|
||||
fields: [
|
||||
"id",
|
||||
"created_at",
|
||||
@@ -387,7 +387,7 @@ describe("validateAndTransformQuery", () => {
|
||||
],
|
||||
})
|
||||
)
|
||||
expect(mockRequest.remoteQueryConfig).toEqual(
|
||||
expect(mockRequest.queryConfig).toEqual(
|
||||
expect.objectContaining({
|
||||
fields: [
|
||||
"id",
|
||||
@@ -447,7 +447,7 @@ describe("validateAndTransformQuery", () => {
|
||||
relations: ["store"],
|
||||
})
|
||||
)
|
||||
expect(mockRequest.remoteQueryConfig).toEqual(
|
||||
expect(mockRequest.queryConfig).toEqual(
|
||||
expect.objectContaining({
|
||||
fields: ["store.name", "id"],
|
||||
})
|
||||
|
||||
@@ -15,10 +15,7 @@ export function applyDefaultFilters<TFilter extends object>(
|
||||
// Currently we only need it to delete filter keys from the request filter object, but this could
|
||||
// be used for other purposes. If we can't find other purposes, we can refactor to accept an array
|
||||
// of strings to delete after filters have been applied.
|
||||
valueToApply = filterValue(
|
||||
req.filterableFields,
|
||||
req.remoteQueryConfig.fields
|
||||
)
|
||||
valueToApply = filterValue(req.filterableFields, req.queryConfig.fields)
|
||||
}
|
||||
|
||||
// If the value to apply is an object, we add it to any existing filters thats already applied
|
||||
|
||||
@@ -108,13 +108,20 @@ export interface MedusaRequest<
|
||||
* An object containing the select, relation to be used with medusa internal services
|
||||
*/
|
||||
retrieveConfig: FindConfig<unknown>
|
||||
|
||||
/**
|
||||
* An object containing fields and variables to be used with the remoteQuery
|
||||
*/
|
||||
remoteQueryConfig: {
|
||||
queryConfig: {
|
||||
fields: string[]
|
||||
pagination: { order?: Record<string, string>; skip: number; take?: number }
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated. Instead use "req.queryConfig"
|
||||
*/
|
||||
remoteQueryConfig: MedusaRequest["queryConfig"]
|
||||
|
||||
/**
|
||||
* An object containing the fields that are filterable e.g `{ id: Any<String> }`
|
||||
*/
|
||||
@@ -163,14 +170,18 @@ export interface PublishableKeyContext {
|
||||
sales_channel_ids: string[]
|
||||
}
|
||||
|
||||
export interface AuthenticatedMedusaRequest<Body = unknown, QueryFields = Record<string, unknown>>
|
||||
extends MedusaRequest<Body, QueryFields> {
|
||||
export interface AuthenticatedMedusaRequest<
|
||||
Body = unknown,
|
||||
QueryFields = Record<string, unknown>
|
||||
> extends MedusaRequest<Body, QueryFields> {
|
||||
auth_context: AuthContext
|
||||
publishable_key_context?: PublishableKeyContext
|
||||
}
|
||||
|
||||
export interface MedusaStoreRequest<Body = unknown, QueryFields = Record<string, unknown>>
|
||||
extends MedusaRequest<Body, QueryFields> {
|
||||
export interface MedusaStoreRequest<
|
||||
Body = unknown,
|
||||
QueryFields = Record<string, unknown>
|
||||
> extends MedusaRequest<Body, QueryFields> {
|
||||
auth_context?: AuthContext
|
||||
publishable_key_context: PublishableKeyContext
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ export const refetchEntities = async (
|
||||
idOrFilter: string | object,
|
||||
scope: MedusaContainer,
|
||||
fields: string[],
|
||||
pagination?: MedusaRequest["remoteQueryConfig"]["pagination"]
|
||||
pagination?: MedusaRequest["queryConfig"]["pagination"]
|
||||
) => {
|
||||
const remoteQuery = scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)
|
||||
const filters = isString(idOrFilter) ? { id: idOrFilter } : idOrFilter
|
||||
|
||||
@@ -90,7 +90,8 @@ export function validateAndTransformQuery<TEntity extends BaseEntity>(
|
||||
|
||||
req.validatedQuery = validated
|
||||
req.filterableFields = getFilterableFields(req.validatedQuery)
|
||||
req.remoteQueryConfig = cnf.remoteQueryConfig as any
|
||||
req.queryConfig = cnf.remoteQueryConfig as any
|
||||
req.remoteQueryConfig = req.queryConfig
|
||||
req.listConfig = (cnf as any).listConfig
|
||||
req.retrieveConfig = (cnf as any).retrieveConfig
|
||||
|
||||
|
||||
@@ -443,7 +443,7 @@ export type QueryConfig<TEntity> = {
|
||||
defaultLimit?: number
|
||||
/**
|
||||
* If the route that will use that configuration is supposed to return a list of entities. This
|
||||
* will change the configuration that will be created on req.listConfig and req.remoteQueryConfig (among
|
||||
* will change the configuration that will be created on req.listConfig and req.queryConfig (among
|
||||
* other things it will include pagination and sorting)
|
||||
*/
|
||||
isList?: boolean
|
||||
|
||||
@@ -24,7 +24,7 @@ export const POST = async (
|
||||
const apiKey = await refetchApiKey(
|
||||
req.params.id,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
|
||||
res.status(200).json({ api_key: apiKey })
|
||||
|
||||
@@ -19,7 +19,7 @@ export const GET = async (
|
||||
const apiKey = await refetchApiKey(
|
||||
req.params.id,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
|
||||
if (!apiKey) {
|
||||
@@ -46,7 +46,7 @@ export const POST = async (
|
||||
const apiKey = await refetchApiKey(
|
||||
req.params.id,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
|
||||
res.status(200).json({ api_key: apiKey })
|
||||
|
||||
@@ -32,7 +32,7 @@ export const POST = async (
|
||||
const updatedApiKey = await refetchApiKey(
|
||||
req.params.id,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
|
||||
res.status(200).json({ api_key: updatedApiKey })
|
||||
|
||||
@@ -20,9 +20,9 @@ export const GET = async (
|
||||
entryPoint: "api_key",
|
||||
variables: {
|
||||
filters: req.filterableFields,
|
||||
...req.remoteQueryConfig.pagination,
|
||||
...req.queryConfig.pagination,
|
||||
},
|
||||
fields: req.remoteQueryConfig.fields,
|
||||
fields: req.queryConfig.fields,
|
||||
})
|
||||
|
||||
const { rows: apiKeys, metadata } = await remoteQuery(queryObject)
|
||||
|
||||
@@ -20,7 +20,7 @@ export const POST = async (
|
||||
const campaign = await refetchCampaign(
|
||||
req.params.id,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
|
||||
res.status(200).json({ campaign })
|
||||
|
||||
@@ -19,7 +19,7 @@ export const GET = async (
|
||||
const campaign = await refetchCampaign(
|
||||
req.params.id,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
|
||||
if (!campaign) {
|
||||
@@ -62,7 +62,7 @@ export const POST = async (
|
||||
const campaign = await refetchCampaign(
|
||||
req.params.id,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
res.status(200).json({ campaign })
|
||||
}
|
||||
|
||||
@@ -21,9 +21,9 @@ export const GET = async (
|
||||
entryPoint: "campaign",
|
||||
variables: {
|
||||
filters: req.filterableFields,
|
||||
...req.remoteQueryConfig.pagination,
|
||||
...req.queryConfig.pagination,
|
||||
},
|
||||
fields: req.remoteQueryConfig.fields,
|
||||
fields: req.queryConfig.fields,
|
||||
})
|
||||
|
||||
const { rows: campaigns, metadata } = await remoteQuery(query)
|
||||
@@ -54,7 +54,7 @@ export const POST = async (
|
||||
const campaign = await refetchCampaign(
|
||||
result[0].id,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
|
||||
res.status(200).json({ campaign })
|
||||
|
||||
@@ -37,7 +37,7 @@ export const POST = async (
|
||||
...req.filterableFields,
|
||||
},
|
||||
},
|
||||
fields: req.remoteQueryConfig.fields,
|
||||
fields: req.queryConfig.fields,
|
||||
})
|
||||
|
||||
const [orderClaim] = await remoteQuery(queryObject)
|
||||
@@ -73,7 +73,7 @@ export const DELETE = async (
|
||||
...req.filterableFields,
|
||||
},
|
||||
},
|
||||
fields: req.remoteQueryConfig.fields,
|
||||
fields: req.queryConfig.fields,
|
||||
})
|
||||
const [orderClaim] = await remoteQuery(queryObject)
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ export const POST = async (
|
||||
...req.filterableFields,
|
||||
},
|
||||
},
|
||||
fields: req.remoteQueryConfig.fields,
|
||||
fields: req.queryConfig.fields,
|
||||
})
|
||||
|
||||
const [orderClaim] = await remoteQuery(queryObject)
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@ export const POST = async (
|
||||
...req.filterableFields,
|
||||
},
|
||||
},
|
||||
fields: req.remoteQueryConfig.fields,
|
||||
fields: req.queryConfig.fields,
|
||||
})
|
||||
|
||||
const [orderClaim] = await remoteQuery(queryObject)
|
||||
|
||||
@@ -37,7 +37,7 @@ export const POST = async (
|
||||
...req.filterableFields,
|
||||
},
|
||||
},
|
||||
fields: req.remoteQueryConfig.fields,
|
||||
fields: req.queryConfig.fields,
|
||||
})
|
||||
|
||||
const [orderClaim] = await remoteQuery(queryObject)
|
||||
@@ -72,7 +72,7 @@ export const DELETE = async (
|
||||
...req.filterableFields,
|
||||
},
|
||||
},
|
||||
fields: req.remoteQueryConfig.fields,
|
||||
fields: req.queryConfig.fields,
|
||||
})
|
||||
const [orderClaim] = await remoteQuery(queryObject)
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ export const POST = async (
|
||||
...req.filterableFields,
|
||||
},
|
||||
},
|
||||
fields: req.remoteQueryConfig.fields,
|
||||
fields: req.queryConfig.fields,
|
||||
})
|
||||
|
||||
const [orderClaim] = await remoteQuery(queryObject)
|
||||
|
||||
+2
-2
@@ -37,7 +37,7 @@ export const POST = async (
|
||||
...req.filterableFields,
|
||||
},
|
||||
},
|
||||
fields: req.remoteQueryConfig.fields,
|
||||
fields: req.queryConfig.fields,
|
||||
})
|
||||
|
||||
const [orderClaim] = await remoteQuery(queryObject)
|
||||
@@ -73,7 +73,7 @@ export const DELETE = async (
|
||||
...req.filterableFields,
|
||||
},
|
||||
},
|
||||
fields: req.remoteQueryConfig.fields,
|
||||
fields: req.queryConfig.fields,
|
||||
})
|
||||
const [orderClaim] = await remoteQuery(queryObject)
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ export const POST = async (
|
||||
...req.filterableFields,
|
||||
},
|
||||
},
|
||||
fields: req.remoteQueryConfig.fields,
|
||||
fields: req.queryConfig.fields,
|
||||
})
|
||||
|
||||
const [orderClaim] = await remoteQuery(queryObject)
|
||||
|
||||
@@ -36,7 +36,7 @@ export const POST = async (
|
||||
...req.filterableFields,
|
||||
},
|
||||
},
|
||||
fields: req.remoteQueryConfig.fields,
|
||||
fields: req.queryConfig.fields,
|
||||
})
|
||||
|
||||
const [orderClaim] = await remoteQuery(queryObject, {
|
||||
|
||||
@@ -14,7 +14,7 @@ export const GET = async (
|
||||
"order_claim",
|
||||
req.params.id,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
|
||||
if (!claim) {
|
||||
|
||||
@@ -24,9 +24,9 @@ export const GET = async (
|
||||
filters: {
|
||||
...req.filterableFields,
|
||||
},
|
||||
...req.remoteQueryConfig.pagination,
|
||||
...req.queryConfig.pagination,
|
||||
},
|
||||
fields: req.remoteQueryConfig.fields,
|
||||
fields: req.queryConfig.fields,
|
||||
})
|
||||
|
||||
const { rows: claims, metadata } = await remoteQuery(queryObject)
|
||||
@@ -64,7 +64,7 @@ export const POST = async (
|
||||
...req.filterableFields,
|
||||
},
|
||||
},
|
||||
fields: req.remoteQueryConfig.fields,
|
||||
fields: req.queryConfig.fields,
|
||||
})
|
||||
|
||||
const [order, orderClaim] = await promiseAll([
|
||||
|
||||
@@ -25,7 +25,7 @@ export const POST = async (
|
||||
const collection = await refetchCollection(
|
||||
req.params.id,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
|
||||
res.status(200).json({
|
||||
|
||||
@@ -19,7 +19,7 @@ export const GET = async (
|
||||
const collection = await refetchCollection(
|
||||
req.params.id,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
|
||||
res.status(200).json({ collection })
|
||||
@@ -49,7 +49,7 @@ export const POST = async (
|
||||
const collection = await refetchCollection(
|
||||
req.params.id,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
|
||||
res.status(200).json({ collection })
|
||||
|
||||
@@ -22,9 +22,9 @@ export const GET = async (
|
||||
entryPoint: "product_collection",
|
||||
variables: {
|
||||
filters: req.filterableFields,
|
||||
...req.remoteQueryConfig.pagination,
|
||||
...req.queryConfig.pagination,
|
||||
},
|
||||
fields: req.remoteQueryConfig.fields,
|
||||
fields: req.queryConfig.fields,
|
||||
})
|
||||
|
||||
const { rows: collections, metadata } = await remoteQuery(query)
|
||||
@@ -54,7 +54,7 @@ export const POST = async (
|
||||
const collection = await refetchCollection(
|
||||
result[0].id,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
|
||||
res.status(200).json({ collection })
|
||||
|
||||
@@ -17,7 +17,7 @@ export const GET = async (
|
||||
const queryObject = remoteQueryObjectFromString({
|
||||
entryPoint: "currency",
|
||||
variables,
|
||||
fields: req.remoteQueryConfig.fields,
|
||||
fields: req.queryConfig.fields,
|
||||
})
|
||||
|
||||
const [currency] = await remoteQuery(queryObject)
|
||||
|
||||
@@ -15,9 +15,9 @@ export const GET = async (
|
||||
entryPoint: "currency",
|
||||
variables: {
|
||||
filters: req.filterableFields,
|
||||
...req.remoteQueryConfig.pagination,
|
||||
...req.queryConfig.pagination,
|
||||
},
|
||||
fields: req.remoteQueryConfig.fields,
|
||||
fields: req.queryConfig.fields,
|
||||
})
|
||||
|
||||
const { rows: currencies, metadata } = await remoteQuery(queryObject)
|
||||
|
||||
@@ -26,7 +26,7 @@ export const POST = async (
|
||||
const customerGroup = await refetchCustomerGroup(
|
||||
req.params.id,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
res.status(200).json({ customer_group: customerGroup })
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ export const GET = async (
|
||||
const customerGroup = await refetchCustomerGroup(
|
||||
req.params.id,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
|
||||
if (!customerGroup) {
|
||||
@@ -58,7 +58,7 @@ export const POST = async (
|
||||
const customerGroup = await refetchCustomerGroup(
|
||||
req.params.id,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
res.status(200).json({ customer_group: customerGroup })
|
||||
}
|
||||
|
||||
@@ -21,9 +21,9 @@ export const GET = async (
|
||||
entryPoint: "customer_group",
|
||||
variables: {
|
||||
filters: req.filterableFields,
|
||||
...req.remoteQueryConfig.pagination,
|
||||
...req.queryConfig.pagination,
|
||||
},
|
||||
fields: req.remoteQueryConfig.fields,
|
||||
fields: req.queryConfig.fields,
|
||||
})
|
||||
|
||||
const { rows: customer_groups, metadata } = await remoteQuery(query)
|
||||
@@ -55,7 +55,7 @@ export const POST = async (
|
||||
const customerGroup = await refetchCustomerGroup(
|
||||
result[0].id,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
|
||||
res.status(200).json({ customer_group: customerGroup })
|
||||
|
||||
@@ -25,7 +25,7 @@ export const GET = async (
|
||||
variables: {
|
||||
filters: { id: req.params.address_id, customer_id: req.params.id },
|
||||
},
|
||||
fields: req.remoteQueryConfig.fields,
|
||||
fields: req.queryConfig.fields,
|
||||
})
|
||||
|
||||
const [address] = await remoteQuery(queryObject)
|
||||
@@ -53,7 +53,7 @@ export const POST = async (
|
||||
const customer = await refetchCustomer(
|
||||
req.params.id,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
|
||||
res.status(200).json({ customer })
|
||||
@@ -73,7 +73,7 @@ export const DELETE = async (
|
||||
const customer = await refetchCustomer(
|
||||
req.params.id,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
|
||||
res.status(200).json({
|
||||
|
||||
@@ -22,9 +22,9 @@ export const GET = async (
|
||||
entryPoint: "customer_address",
|
||||
variables: {
|
||||
filters: { ...req.filterableFields, customer_id: customerId },
|
||||
...req.remoteQueryConfig.pagination,
|
||||
...req.queryConfig.pagination,
|
||||
},
|
||||
fields: req.remoteQueryConfig.fields,
|
||||
fields: req.queryConfig.fields,
|
||||
})
|
||||
|
||||
const { rows: addresses, metadata } = await remoteQuery(query)
|
||||
@@ -60,7 +60,7 @@ export const POST = async (
|
||||
const customer = await refetchCustomer(
|
||||
customerId,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
|
||||
res.status(200).json({ customer })
|
||||
|
||||
@@ -24,11 +24,7 @@ export const POST = async (
|
||||
},
|
||||
})
|
||||
|
||||
const customer = await refetchCustomer(
|
||||
id,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
)
|
||||
const customer = await refetchCustomer(id, req.scope, req.queryConfig.fields)
|
||||
|
||||
res.status(200).json({ customer: customer })
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ export const GET = async (
|
||||
const customer = await refetchCustomer(
|
||||
req.params.id,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
|
||||
if (!customer) {
|
||||
@@ -58,7 +58,7 @@ export const POST = async (
|
||||
const customer = await refetchCustomer(
|
||||
req.params.id,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
res.status(200).json({ customer })
|
||||
}
|
||||
|
||||
@@ -22,9 +22,9 @@ export const GET = async (
|
||||
entryPoint: "customers",
|
||||
variables: {
|
||||
filters: req.filterableFields,
|
||||
...req.remoteQueryConfig.pagination,
|
||||
...req.queryConfig.pagination,
|
||||
},
|
||||
fields: req.remoteQueryConfig.fields,
|
||||
fields: req.queryConfig.fields,
|
||||
})
|
||||
|
||||
const { rows: customers, metadata } = await remoteQuery(query)
|
||||
@@ -58,7 +58,7 @@ export const POST = async (
|
||||
const customer = await refetchCustomer(
|
||||
result[0].id,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
|
||||
res.status(200).json({ customer })
|
||||
|
||||
@@ -30,9 +30,9 @@ export const GET = async (
|
||||
...req.filterableFields,
|
||||
is_draft_order: true,
|
||||
},
|
||||
...req.remoteQueryConfig.pagination,
|
||||
...req.queryConfig.pagination,
|
||||
},
|
||||
fields: req.remoteQueryConfig.fields,
|
||||
fields: req.queryConfig.fields,
|
||||
})
|
||||
|
||||
const { rows: draft_orders, metadata } = await remoteQuery(queryObject)
|
||||
@@ -90,7 +90,7 @@ export const POST = async (
|
||||
const draftOrder = await refetchOrder(
|
||||
result.id,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
|
||||
res.status(200).json({ draft_order: draftOrder })
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@ export const POST = async (
|
||||
...req.filterableFields,
|
||||
},
|
||||
},
|
||||
fields: req.remoteQueryConfig.fields,
|
||||
fields: req.queryConfig.fields,
|
||||
})
|
||||
|
||||
const [orderExchange] = await remoteQuery(queryObject)
|
||||
|
||||
@@ -37,7 +37,7 @@ export const POST = async (
|
||||
...req.filterableFields,
|
||||
},
|
||||
},
|
||||
fields: req.remoteQueryConfig.fields,
|
||||
fields: req.queryConfig.fields,
|
||||
})
|
||||
|
||||
const [orderExchange] = await remoteQuery(queryObject)
|
||||
@@ -73,7 +73,7 @@ export const DELETE = async (
|
||||
...req.filterableFields,
|
||||
},
|
||||
},
|
||||
fields: req.remoteQueryConfig.fields,
|
||||
fields: req.queryConfig.fields,
|
||||
})
|
||||
const [orderExchange] = await remoteQuery(queryObject)
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ export const POST = async (
|
||||
...req.filterableFields,
|
||||
},
|
||||
},
|
||||
fields: req.remoteQueryConfig.fields,
|
||||
fields: req.queryConfig.fields,
|
||||
})
|
||||
|
||||
const [orderExchange] = await remoteQuery(queryObject)
|
||||
|
||||
+2
-2
@@ -37,7 +37,7 @@ export const POST = async (
|
||||
...req.filterableFields,
|
||||
},
|
||||
},
|
||||
fields: req.remoteQueryConfig.fields,
|
||||
fields: req.queryConfig.fields,
|
||||
})
|
||||
|
||||
const [orderExchange] = await remoteQuery(queryObject)
|
||||
@@ -73,7 +73,7 @@ export const DELETE = async (
|
||||
...req.filterableFields,
|
||||
},
|
||||
},
|
||||
fields: req.remoteQueryConfig.fields,
|
||||
fields: req.queryConfig.fields,
|
||||
})
|
||||
const [orderExchange] = await remoteQuery(queryObject)
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ export const POST = async (
|
||||
...req.filterableFields,
|
||||
},
|
||||
},
|
||||
fields: req.remoteQueryConfig.fields,
|
||||
fields: req.queryConfig.fields,
|
||||
})
|
||||
|
||||
const [orderExchange] = await remoteQuery(queryObject)
|
||||
|
||||
@@ -36,7 +36,7 @@ export const POST = async (
|
||||
...req.filterableFields,
|
||||
},
|
||||
},
|
||||
fields: req.remoteQueryConfig.fields,
|
||||
fields: req.queryConfig.fields,
|
||||
})
|
||||
|
||||
const [orderExchange] = await remoteQuery(queryObject, {
|
||||
|
||||
@@ -14,7 +14,7 @@ export const GET = async (
|
||||
"order_exchange",
|
||||
req.params.id,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
|
||||
if (!exchange) {
|
||||
|
||||
@@ -24,9 +24,9 @@ export const GET = async (
|
||||
filters: {
|
||||
...req.filterableFields,
|
||||
},
|
||||
...req.remoteQueryConfig.pagination,
|
||||
...req.queryConfig.pagination,
|
||||
},
|
||||
fields: req.remoteQueryConfig.fields,
|
||||
fields: req.queryConfig.fields,
|
||||
})
|
||||
|
||||
const { rows: exchanges, metadata } = await remoteQuery(queryObject)
|
||||
@@ -64,7 +64,7 @@ export const POST = async (
|
||||
...req.filterableFields,
|
||||
},
|
||||
},
|
||||
fields: req.remoteQueryConfig.fields,
|
||||
fields: req.queryConfig.fields,
|
||||
})
|
||||
|
||||
const [order, orderExchange] = await promiseAll([
|
||||
|
||||
@@ -17,9 +17,9 @@ export const GET = async (
|
||||
entryPoint: "fulfillment_provider",
|
||||
variables: {
|
||||
filters: req.filterableFields,
|
||||
...req.remoteQueryConfig.pagination,
|
||||
...req.queryConfig.pagination,
|
||||
},
|
||||
fields: req.remoteQueryConfig.fields,
|
||||
fields: req.queryConfig.fields,
|
||||
})
|
||||
|
||||
const { rows: fulfillment_providers, metadata } = await remoteQuery(
|
||||
|
||||
+2
-2
@@ -33,7 +33,7 @@ export const GET = async (
|
||||
variables: {
|
||||
id: req.params.zone_id,
|
||||
},
|
||||
fields: req.remoteQueryConfig.fields,
|
||||
fields: req.queryConfig.fields,
|
||||
})
|
||||
)
|
||||
|
||||
@@ -85,7 +85,7 @@ export const POST = async (
|
||||
variables: {
|
||||
id: req.params.id,
|
||||
},
|
||||
fields: req.remoteQueryConfig.fields,
|
||||
fields: req.queryConfig.fields,
|
||||
})
|
||||
)
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ export const POST = async (
|
||||
const fulfillmentSet = await refetchFulfillmentSet(
|
||||
req.params.id,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
|
||||
res.status(200).json({ fulfillment_set: fulfillmentSet })
|
||||
|
||||
@@ -18,7 +18,7 @@ export const POST = async (
|
||||
const fulfillment = await refetchFulfillment(
|
||||
id,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
|
||||
res.status(200).json({ fulfillment })
|
||||
|
||||
@@ -24,7 +24,7 @@ export const POST = async (
|
||||
const fulfillment = await refetchFulfillment(
|
||||
id,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
|
||||
res.status(200).json({ fulfillment })
|
||||
|
||||
@@ -23,7 +23,7 @@ export const POST = async (
|
||||
const fulfillment = await refetchFulfillment(
|
||||
fullfillment.id,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
|
||||
res.status(200).json({ fulfillment })
|
||||
|
||||
+2
-2
@@ -52,7 +52,7 @@ export const DELETE = async (
|
||||
const inventoryItem = await refetchInventoryItem(
|
||||
id,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
|
||||
res.status(200).json({
|
||||
@@ -77,7 +77,7 @@ export const POST = async (
|
||||
const inventoryItem = await refetchInventoryItem(
|
||||
id,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
|
||||
res.status(200).json({
|
||||
|
||||
@@ -33,7 +33,7 @@ export const POST = async (
|
||||
const inventoryItem = await refetchInventoryItem(
|
||||
id,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
res.status(200).json({ inventory_item: inventoryItem })
|
||||
}
|
||||
@@ -50,9 +50,9 @@ export const GET = async (
|
||||
entryPoint: "inventory_levels",
|
||||
variables: {
|
||||
filters: { ...req.filterableFields, inventory_item_id: id },
|
||||
...req.remoteQueryConfig.pagination,
|
||||
...req.queryConfig.pagination,
|
||||
},
|
||||
fields: req.remoteQueryConfig.fields,
|
||||
fields: req.queryConfig.fields,
|
||||
})
|
||||
|
||||
const { rows: inventory_levels, metadata } = await remoteQuery(query)
|
||||
|
||||
@@ -19,7 +19,7 @@ export const GET = async (
|
||||
const inventoryItem = await refetchInventoryItem(
|
||||
id,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
if (!inventoryItem) {
|
||||
throw new MedusaError(
|
||||
@@ -49,7 +49,7 @@ export const POST = async (
|
||||
const inventoryItem = await refetchInventoryItem(
|
||||
id,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
|
||||
res.status(200).json({
|
||||
|
||||
@@ -22,7 +22,7 @@ export const POST = async (
|
||||
const inventoryItem = await refetchInventoryItem(
|
||||
result[0].id,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
|
||||
res.status(200).json({ inventory_item: inventoryItem })
|
||||
@@ -38,9 +38,9 @@ export const GET = async (
|
||||
entryPoint: "inventory_items",
|
||||
variables: {
|
||||
filters: req.filterableFields,
|
||||
...req.remoteQueryConfig.pagination,
|
||||
...req.queryConfig.pagination,
|
||||
},
|
||||
fields: req.remoteQueryConfig.fields,
|
||||
fields: req.queryConfig.fields,
|
||||
})
|
||||
|
||||
const { rows: inventory_items, metadata } = await remoteQuery({
|
||||
|
||||
@@ -18,7 +18,7 @@ export const POST = async (
|
||||
const invite = await refetchInvite(
|
||||
result[0].id,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
|
||||
res.status(200).json({ invite })
|
||||
|
||||
@@ -13,11 +13,7 @@ export const GET = async (
|
||||
res: MedusaResponse<HttpTypes.AdminInviteResponse>
|
||||
) => {
|
||||
const { id } = req.params
|
||||
const invite = await refetchInvite(
|
||||
id,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
)
|
||||
const invite = await refetchInvite(id, req.scope, req.queryConfig.fields)
|
||||
|
||||
if (!invite) {
|
||||
throw new MedusaError(
|
||||
|
||||
@@ -20,9 +20,9 @@ export const GET = async (
|
||||
entryPoint: "invite",
|
||||
variables: {
|
||||
filters: req.filterableFields,
|
||||
...req.remoteQueryConfig.pagination,
|
||||
...req.queryConfig.pagination,
|
||||
},
|
||||
fields: req.remoteQueryConfig.fields,
|
||||
fields: req.queryConfig.fields,
|
||||
})
|
||||
|
||||
const { rows: invites, metadata } = await remoteQuery(queryObject)
|
||||
@@ -52,7 +52,7 @@ export const POST = async (
|
||||
const invite = await refetchInvite(
|
||||
result[0].id,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
|
||||
res.status(200).json({ invite })
|
||||
|
||||
@@ -14,7 +14,7 @@ export const GET = async (
|
||||
"notification",
|
||||
req.params.id,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
res.status(200).json({ notification })
|
||||
}
|
||||
|
||||
@@ -13,8 +13,8 @@ export const GET = async (
|
||||
"notification",
|
||||
req.filterableFields,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields,
|
||||
req.remoteQueryConfig.pagination
|
||||
req.queryConfig.fields,
|
||||
req.queryConfig.pagination
|
||||
)
|
||||
|
||||
res.json({
|
||||
|
||||
@@ -23,7 +23,7 @@ export const POST = async (
|
||||
const queryObject = remoteQueryObjectFromString({
|
||||
entryPoint: "order",
|
||||
variables: { id },
|
||||
fields: req.remoteQueryConfig.fields,
|
||||
fields: req.queryConfig.fields,
|
||||
})
|
||||
|
||||
const [order] = await remoteQuery(queryObject)
|
||||
|
||||
@@ -29,7 +29,7 @@ export const POST = async (
|
||||
const queryObject = remoteQueryObjectFromString({
|
||||
entryPoint: "order",
|
||||
variables,
|
||||
fields: req.remoteQueryConfig.fields,
|
||||
fields: req.queryConfig.fields,
|
||||
})
|
||||
|
||||
const [order] = await remoteQuery(queryObject)
|
||||
|
||||
@@ -23,7 +23,7 @@ export const GET = async (
|
||||
order_id: id,
|
||||
},
|
||||
},
|
||||
fields: req.remoteQueryConfig.fields,
|
||||
fields: req.queryConfig.fields,
|
||||
})
|
||||
|
||||
const order_changes = await remoteQuery(queryObject)
|
||||
|
||||
@@ -26,7 +26,7 @@ export const POST = async (
|
||||
const queryObject = remoteQueryObjectFromString({
|
||||
entryPoint: "order",
|
||||
variables: { id },
|
||||
fields: req.remoteQueryConfig.fields,
|
||||
fields: req.queryConfig.fields,
|
||||
})
|
||||
|
||||
const [order] = await remoteQuery(queryObject)
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@ export const POST = async (
|
||||
const queryObject = remoteQueryObjectFromString({
|
||||
entryPoint: "order",
|
||||
variables,
|
||||
fields: req.remoteQueryConfig.fields,
|
||||
fields: req.queryConfig.fields,
|
||||
})
|
||||
|
||||
const [order] = await remoteQuery(queryObject)
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ export const POST = async (
|
||||
"order",
|
||||
orderId,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
|
||||
res.status(200).json({ order })
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@ export const POST = async (
|
||||
const queryObject = remoteQueryObjectFromString({
|
||||
entryPoint: "order",
|
||||
variables,
|
||||
fields: req.remoteQueryConfig.fields,
|
||||
fields: req.queryConfig.fields,
|
||||
})
|
||||
|
||||
const [order] = await remoteQuery(queryObject)
|
||||
|
||||
@@ -28,7 +28,7 @@ export const POST = async (
|
||||
const queryObject = remoteQueryObjectFromString({
|
||||
entryPoint: "order",
|
||||
variables: { id: req.params.id },
|
||||
fields: req.remoteQueryConfig.fields,
|
||||
fields: req.queryConfig.fields,
|
||||
})
|
||||
|
||||
const [order] = await remoteQuery(queryObject)
|
||||
|
||||
@@ -22,9 +22,7 @@ export const GET = async (
|
||||
...req.filterableFields,
|
||||
order_id: id,
|
||||
},
|
||||
fields: deduplicate(
|
||||
req.remoteQueryConfig.fields.concat(["item_id", "version"])
|
||||
),
|
||||
fields: deduplicate(req.queryConfig.fields.concat(["item_id", "version"])),
|
||||
})
|
||||
|
||||
const data = result.data
|
||||
|
||||
@@ -20,7 +20,7 @@ export const GET = async (
|
||||
const workflow = getOrderDetailWorkflow(req.scope)
|
||||
const { result } = await workflow.run({
|
||||
input: {
|
||||
fields: req.remoteQueryConfig.fields,
|
||||
fields: req.queryConfig.fields,
|
||||
order_id: req.params.id,
|
||||
version: req.validatedQuery.version as number,
|
||||
},
|
||||
@@ -46,7 +46,7 @@ export const POST = async (
|
||||
const result = await query.graph({
|
||||
entity: "order",
|
||||
filters: { id: req.params.id },
|
||||
fields: req.remoteQueryConfig.fields,
|
||||
fields: req.queryConfig.fields,
|
||||
})
|
||||
|
||||
res.status(200).json({ order: result.data[0] as AdminOrder })
|
||||
|
||||
@@ -26,7 +26,7 @@ export const POST = async (
|
||||
const result = await query.graph({
|
||||
entity: "order",
|
||||
filters: { id: orderId },
|
||||
fields: req.remoteQueryConfig.fields,
|
||||
fields: req.queryConfig.fields,
|
||||
})
|
||||
|
||||
res.status(200).json({ order: result.data[0] as AdminOrder })
|
||||
|
||||
@@ -31,7 +31,7 @@ export const POST = async (
|
||||
const queryObject = remoteQueryObjectFromString({
|
||||
entryPoint: "order",
|
||||
variables,
|
||||
fields: req.remoteQueryConfig.fields,
|
||||
fields: req.queryConfig.fields,
|
||||
})
|
||||
|
||||
const [order] = await remoteQuery(queryObject)
|
||||
|
||||
@@ -14,13 +14,13 @@ export const GET = async (
|
||||
...req.filterableFields,
|
||||
is_draft_order: false,
|
||||
},
|
||||
...req.remoteQueryConfig.pagination,
|
||||
...req.queryConfig.pagination,
|
||||
}
|
||||
|
||||
const workflow = getOrdersListWorkflow(req.scope)
|
||||
const { result } = await workflow.run({
|
||||
input: {
|
||||
fields: req.remoteQueryConfig.fields,
|
||||
fields: req.queryConfig.fields,
|
||||
variables,
|
||||
},
|
||||
})
|
||||
|
||||
@@ -25,7 +25,7 @@ export const POST = async (
|
||||
"payment_collection",
|
||||
id,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
|
||||
res.status(200).json({ payment_collection: paymentCollection })
|
||||
|
||||
@@ -19,7 +19,7 @@ export const POST = async (
|
||||
"payment_collection",
|
||||
result[0].id,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
|
||||
res.status(200).json({ payment_collection: paymentCollection })
|
||||
|
||||
@@ -21,11 +21,7 @@ export const POST = async (
|
||||
},
|
||||
})
|
||||
|
||||
const payment = await refetchPayment(
|
||||
id,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
)
|
||||
const payment = await refetchPayment(id, req.scope, req.queryConfig.fields)
|
||||
|
||||
res.status(200).json({ payment })
|
||||
}
|
||||
|
||||
@@ -20,11 +20,7 @@ export const POST = async (
|
||||
},
|
||||
})
|
||||
|
||||
const payment = await refetchPayment(
|
||||
id,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
)
|
||||
const payment = await refetchPayment(id, req.scope, req.queryConfig.fields)
|
||||
|
||||
res.status(200).json({ payment })
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ export const GET = async (
|
||||
const payment = await refetchPayment(
|
||||
req.params.id,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
|
||||
res.status(200).json({ payment })
|
||||
|
||||
@@ -17,9 +17,9 @@ export const GET = async (
|
||||
entryPoint: "payment_provider",
|
||||
variables: {
|
||||
filters: req.filterableFields,
|
||||
...req.remoteQueryConfig.pagination,
|
||||
...req.queryConfig.pagination,
|
||||
},
|
||||
fields: req.remoteQueryConfig.fields,
|
||||
fields: req.queryConfig.fields,
|
||||
})
|
||||
|
||||
const { rows: payment_providers, metadata } = await remoteQuery(queryObject)
|
||||
|
||||
@@ -17,9 +17,9 @@ export const GET = async (
|
||||
entryPoint: "payment",
|
||||
variables: {
|
||||
filters: req.filterableFields,
|
||||
...req.remoteQueryConfig.pagination,
|
||||
...req.queryConfig.pagination,
|
||||
},
|
||||
fields: req.remoteQueryConfig.fields,
|
||||
fields: req.queryConfig.fields,
|
||||
})
|
||||
|
||||
const { rows: payments, metadata } = await remoteQuery(queryObject)
|
||||
|
||||
@@ -39,11 +39,7 @@ export const POST = async (
|
||||
},
|
||||
})
|
||||
|
||||
const priceList = await fetchPriceList(
|
||||
id,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
)
|
||||
const priceList = await fetchPriceList(id, req.scope, req.queryConfig.fields)
|
||||
|
||||
res.status(200).json({ price_list: priceList })
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ export const GET = async (
|
||||
const price_list = await fetchPriceList(
|
||||
req.params.id,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
|
||||
res.status(200).json({ price_list })
|
||||
@@ -34,11 +34,7 @@ export const POST = async (
|
||||
input: { price_lists_data: [{ ...req.validatedBody, id }] },
|
||||
})
|
||||
|
||||
const price_list = await fetchPriceList(
|
||||
id,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
)
|
||||
const price_list = await fetchPriceList(id, req.scope, req.queryConfig.fields)
|
||||
|
||||
res.status(200).json({ price_list })
|
||||
}
|
||||
|
||||
@@ -21,9 +21,9 @@ export const GET = async (
|
||||
entryPoint: "price_list",
|
||||
variables: {
|
||||
filters: req.filterableFields,
|
||||
...req.remoteQueryConfig.pagination,
|
||||
...req.queryConfig.pagination,
|
||||
},
|
||||
fields: req.remoteQueryConfig.fields,
|
||||
fields: req.queryConfig.fields,
|
||||
})
|
||||
|
||||
const { rows: priceLists, metadata } = await remoteQuery(queryObject)
|
||||
@@ -48,7 +48,7 @@ export const POST = async (
|
||||
const price_list = await fetchPriceList(
|
||||
result[0].id,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
|
||||
res.status(200).json({ price_list })
|
||||
|
||||
@@ -18,7 +18,7 @@ export const GET = async (
|
||||
"price_preference",
|
||||
req.params.id,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
|
||||
res.status(200).json({ price_preference })
|
||||
@@ -39,7 +39,7 @@ export const POST = async (
|
||||
"price_preference",
|
||||
id,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
|
||||
res.status(200).json({ price_preference })
|
||||
|
||||
@@ -15,8 +15,8 @@ export const GET = async (
|
||||
"price_preference",
|
||||
req.filterableFields,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields,
|
||||
req.remoteQueryConfig.pagination
|
||||
req.queryConfig.fields,
|
||||
req.queryConfig.pagination
|
||||
)
|
||||
res.json({
|
||||
price_preferences: price_preferences,
|
||||
@@ -39,7 +39,7 @@ export const POST = async (
|
||||
"price_preference",
|
||||
result[0].id,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
|
||||
res.status(200).json({ price_preference })
|
||||
|
||||
@@ -23,7 +23,7 @@ export const POST = async (
|
||||
"product_category",
|
||||
id,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
|
||||
res.status(200).json({ product_category: category })
|
||||
|
||||
@@ -25,7 +25,7 @@ export const GET = async (
|
||||
"product_category",
|
||||
{ id: req.params.id, ...req.filterableFields },
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
|
||||
if (!category) {
|
||||
@@ -52,7 +52,7 @@ export const POST = async (
|
||||
"product_category",
|
||||
{ id, ...req.filterableFields },
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
|
||||
res.status(200).json({ product_category: category })
|
||||
|
||||
@@ -14,8 +14,8 @@ export const GET = async (
|
||||
"product_category",
|
||||
req.filterableFields,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields,
|
||||
req.remoteQueryConfig.pagination
|
||||
req.queryConfig.fields,
|
||||
req.queryConfig.pagination
|
||||
)
|
||||
|
||||
res.json({
|
||||
@@ -38,7 +38,7 @@ export const POST = async (
|
||||
"product_category",
|
||||
{ id: result[0].id, ...req.filterableFields },
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
|
||||
res.status(200).json({ product_category: category })
|
||||
|
||||
@@ -23,7 +23,7 @@ export const GET = async (
|
||||
"product_tag",
|
||||
req.params.id,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
|
||||
res.status(200).json({ product_tag: productTag })
|
||||
@@ -58,7 +58,7 @@ export const POST = async (
|
||||
"product_tag",
|
||||
result[0].id,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
|
||||
res.status(200).json({ product_tag: productTag })
|
||||
|
||||
@@ -16,8 +16,8 @@ export const GET = async (
|
||||
"product_tag",
|
||||
req.filterableFields,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields,
|
||||
req.remoteQueryConfig.pagination
|
||||
req.queryConfig.fields,
|
||||
req.queryConfig.pagination
|
||||
)
|
||||
|
||||
res.json({
|
||||
@@ -42,7 +42,7 @@ export const POST = async (
|
||||
"product_tag",
|
||||
result[0].id,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
|
||||
res.status(200).json({ product_tag: productTag })
|
||||
|
||||
@@ -22,7 +22,7 @@ export const GET = async (
|
||||
const productType = await refetchProductType(
|
||||
req.params.id,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
|
||||
res.status(200).json({ product_type: productType })
|
||||
@@ -55,7 +55,7 @@ export const POST = async (
|
||||
const productType = await refetchProductType(
|
||||
result[0].id,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
|
||||
res.status(200).json({ product_type: productType })
|
||||
|
||||
@@ -20,9 +20,9 @@ export const GET = async (
|
||||
entryPoint: "product_type",
|
||||
variables: {
|
||||
filters: req.filterableFields,
|
||||
...req.remoteQueryConfig.pagination,
|
||||
...req.queryConfig.pagination,
|
||||
},
|
||||
fields: req.remoteQueryConfig.fields,
|
||||
fields: req.queryConfig.fields,
|
||||
})
|
||||
|
||||
const { rows: product_types, metadata } = await remoteQuery(queryObject)
|
||||
@@ -48,7 +48,7 @@ export const POST = async (
|
||||
const productType = await refetchProductType(
|
||||
result[0].id,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
|
||||
res.status(200).json({ product_type: productType })
|
||||
|
||||
@@ -11,12 +11,12 @@ export const GET = async (
|
||||
req: AuthenticatedMedusaRequest<HttpTypes.AdminProductVariantParams>,
|
||||
res: MedusaResponse<HttpTypes.AdminProductVariantListResponse>
|
||||
) => {
|
||||
const withInventoryQuantity = req.remoteQueryConfig.fields.some((field) =>
|
||||
const withInventoryQuantity = req.queryConfig.fields.some((field) =>
|
||||
field.includes("inventory_quantity")
|
||||
)
|
||||
|
||||
if (withInventoryQuantity) {
|
||||
req.remoteQueryConfig.fields = req.remoteQueryConfig.fields.filter(
|
||||
req.queryConfig.fields = req.queryConfig.fields.filter(
|
||||
(field) => !field.includes("inventory_quantity")
|
||||
)
|
||||
}
|
||||
@@ -25,8 +25,8 @@ export const GET = async (
|
||||
"variant",
|
||||
{ ...req.filterableFields },
|
||||
req.scope,
|
||||
remapKeysForVariant(req.remoteQueryConfig.fields ?? []),
|
||||
req.remoteQueryConfig.pagination
|
||||
remapKeysForVariant(req.queryConfig.fields ?? []),
|
||||
req.queryConfig.pagination
|
||||
)
|
||||
|
||||
if (withInventoryQuantity) {
|
||||
|
||||
@@ -21,7 +21,7 @@ export const GET = async (
|
||||
"product_option",
|
||||
{ id: optionId, product_id: productId },
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
|
||||
res.status(200).json({ product_option: productOption })
|
||||
@@ -49,7 +49,7 @@ export const POST = async (
|
||||
"product",
|
||||
productId,
|
||||
req.scope,
|
||||
remapKeysForProduct(req.remoteQueryConfig.fields ?? [])
|
||||
remapKeysForProduct(req.queryConfig.fields ?? [])
|
||||
)
|
||||
|
||||
res.status(200).json({ product: remapProductResponse(product) })
|
||||
@@ -71,7 +71,7 @@ export const DELETE = async (
|
||||
"product",
|
||||
productId,
|
||||
req.scope,
|
||||
remapKeysForProduct(req.remoteQueryConfig.fields ?? [])
|
||||
remapKeysForProduct(req.queryConfig.fields ?? [])
|
||||
)
|
||||
|
||||
res.status(200).json({
|
||||
|
||||
@@ -18,8 +18,8 @@ export const GET = async (
|
||||
"product_option",
|
||||
{ ...req.filterableFields, product_id: productId },
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields,
|
||||
req.remoteQueryConfig.pagination
|
||||
req.queryConfig.fields,
|
||||
req.queryConfig.pagination
|
||||
)
|
||||
|
||||
res.json({
|
||||
@@ -55,7 +55,7 @@ export const POST = async (
|
||||
"product",
|
||||
productId,
|
||||
req.scope,
|
||||
remapKeysForProduct(req.remoteQueryConfig.fields ?? [])
|
||||
remapKeysForProduct(req.queryConfig.fields ?? [])
|
||||
)
|
||||
res.status(200).json({ product: remapProductResponse(product) })
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ export const GET = async (
|
||||
req: AuthenticatedMedusaRequest,
|
||||
res: MedusaResponse<HttpTypes.AdminProductResponse>
|
||||
) => {
|
||||
const selectFields = remapKeysForProduct(req.remoteQueryConfig.fields ?? [])
|
||||
const selectFields = remapKeysForProduct(req.queryConfig.fields ?? [])
|
||||
const product = await refetchEntity(
|
||||
"product",
|
||||
req.params.id,
|
||||
@@ -66,7 +66,7 @@ export const POST = async (
|
||||
"product",
|
||||
result[0].id,
|
||||
req.scope,
|
||||
remapKeysForProduct(req.remoteQueryConfig.fields ?? [])
|
||||
remapKeysForProduct(req.queryConfig.fields ?? [])
|
||||
)
|
||||
|
||||
res.status(200).json({ product: remapProductResponse(product) })
|
||||
|
||||
+2
-2
@@ -28,7 +28,7 @@ export const POST = async (
|
||||
const variant = await refetchVariant(
|
||||
variantId,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
|
||||
res.status(200).json({ variant })
|
||||
@@ -55,7 +55,7 @@ export const DELETE = async (
|
||||
const parent = await refetchVariant(
|
||||
variantId,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
|
||||
res.status(200).json({
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ export const POST = async (
|
||||
const variant = await refetchVariant(
|
||||
variantId,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
req.queryConfig.fields
|
||||
)
|
||||
|
||||
res.status(200).json({ variant })
|
||||
|
||||
@@ -28,7 +28,7 @@ export const GET = async (
|
||||
"variant",
|
||||
variables,
|
||||
req.scope,
|
||||
remapKeysForVariant(req.remoteQueryConfig.fields ?? [])
|
||||
remapKeysForVariant(req.queryConfig.fields ?? [])
|
||||
)
|
||||
|
||||
res.status(200).json({ variant: remapVariantResponse(variant) })
|
||||
@@ -56,7 +56,7 @@ export const POST = async (
|
||||
"product",
|
||||
productId,
|
||||
req.scope,
|
||||
remapKeysForProduct(req.remoteQueryConfig.fields ?? [])
|
||||
remapKeysForProduct(req.queryConfig.fields ?? [])
|
||||
)
|
||||
|
||||
res.status(200).json({ product: remapProductResponse(product) })
|
||||
@@ -78,7 +78,7 @@ export const DELETE = async (
|
||||
"product",
|
||||
productId,
|
||||
req.scope,
|
||||
remapKeysForProduct(req.remoteQueryConfig.fields ?? [])
|
||||
remapKeysForProduct(req.queryConfig.fields ?? [])
|
||||
)
|
||||
|
||||
res.status(200).json({
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user