Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ed9891577f | ||
|
|
41c7ad25e7 | ||
|
|
2056e6c766 | ||
|
|
f2377be69c | ||
|
|
d6b84e4480 | ||
|
|
51eadd98dc |
No files matched your search
@@ -149,12 +149,35 @@ export async function GET(req: MedusaRequest, res: MedusaResponse) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// calculatePrices exige currency_code en el contexto -- no alcanza con
|
||||||
|
// region_id solo (a diferencia de /store/products nativo, que lo
|
||||||
|
// resuelve el middleware setPricingContext; esta ruta no pasa por esa
|
||||||
|
// cadena). Resolvemos la moneda real de la region en vez de asumir COP
|
||||||
|
// fijo, por si el catalogo suma otra region/moneda mas adelante.
|
||||||
|
let currencyCode: string | undefined;
|
||||||
|
if (regionId) {
|
||||||
|
const { data: regions = [] } = await query.graph({
|
||||||
|
entity: "region",
|
||||||
|
fields: ["id", "currency_code"],
|
||||||
|
filters: { id: regionId },
|
||||||
|
});
|
||||||
|
currencyCode = regions[0]?.currency_code;
|
||||||
|
}
|
||||||
|
|
||||||
const { data: products = [] } = await query.graph({
|
const { data: products = [] } = await query.graph({
|
||||||
entity: "product",
|
entity: "product",
|
||||||
fields: PRODUCT_FIELDS,
|
fields: PRODUCT_FIELDS,
|
||||||
filters: { id: productIds },
|
filters: { id: productIds },
|
||||||
context: regionId
|
context:
|
||||||
? { variants: { calculated_price: QueryContext({ region_id: regionId }) } }
|
regionId && currencyCode
|
||||||
|
? {
|
||||||
|
variants: {
|
||||||
|
calculated_price: QueryContext({
|
||||||
|
region_id: regionId,
|
||||||
|
currency_code: currencyCode,
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
}
|
||||||
: {},
|
: {},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ spec:
|
|||||||
memory: 64Mi
|
memory: 64Mi
|
||||||
|
|
||||||
- name: migrations
|
- name: migrations
|
||||||
image: gitea.cruzcloud.net/devops/ecommerce-medusa:v1.0.165
|
image: gitea.cruzcloud.net/devops/ecommerce-medusa:v1.0.168
|
||||||
imagePullPolicy: IfNotPresent
|
imagePullPolicy: IfNotPresent
|
||||||
command:
|
command:
|
||||||
- node
|
- node
|
||||||
@@ -86,7 +86,7 @@ spec:
|
|||||||
|
|
||||||
containers:
|
containers:
|
||||||
- name: app
|
- name: app
|
||||||
image: gitea.cruzcloud.net/devops/ecommerce-medusa:v1.0.165
|
image: gitea.cruzcloud.net/devops/ecommerce-medusa:v1.0.168
|
||||||
imagePullPolicy: IfNotPresent
|
imagePullPolicy: IfNotPresent
|
||||||
envFrom:
|
envFrom:
|
||||||
- configMapRef:
|
- configMapRef:
|
||||||
|
|||||||
Reference in new issue
Block a user