mejoras en el modelo de clarificacion de productos

This commit is contained in:
Lucas Tettamanti
2026-01-17 06:31:49 -03:00
parent 63b9ecef61
commit 204403560e
24 changed files with 1940 additions and 873 deletions

View File

@@ -76,6 +76,30 @@ export const api = {
return fetch("/products/sync", { method: "POST" }).then(r => r.json());
},
async updateProductUnit(wooProductId, { sell_unit }) {
return fetch(`/products/${encodeURIComponent(wooProductId)}/unit`, {
method: "PATCH",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ sell_unit }),
}).then(r => r.json());
},
async updateProduct(wooProductId, { sell_unit, categories }) {
return fetch(`/products/${encodeURIComponent(wooProductId)}`, {
method: "PATCH",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ sell_unit, categories }),
}).then(r => r.json());
},
async updateProductsUnit(wooProductIds, { sell_unit }) {
return fetch(`/products/bulk/unit`, {
method: "PATCH",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ woo_product_ids: wooProductIds, sell_unit }),
}).then(r => r.json());
},
// Aliases CRUD
async aliases({ q = "", woo_product_id = null, limit = 200 } = {}) {
const u = new URL("/aliases", location.origin);