feat: add private product management endpoints for updating canonical names and merging products
Test Suite / test (24.15.0) (push) Has been cancelled

This commit is contained in:
Nils-Johan Gynther
2026-05-09 23:19:28 +02:00
parent 8e276a34fe
commit 14a1107466
4 changed files with 134 additions and 34 deletions
@@ -191,12 +191,33 @@ class AdminRepository {
Future<void> restoreProduct(int productId) =>
_postVoid(ProductApiPaths.restore(productId));
// ── Product canonical name updates ────────────────────────────────────────
// Admin can update any product; users can only update their own private products
Future<void> updateCanonicalName(int productId, String canonicalName) =>
_patchVoid(
ProductApiPaths.canonicalName(productId),
{'canonicalName': canonicalName.trim()},
);
Future<void> updateCanonicalNamePrivate(int productId, String canonicalName) =>
_patchVoid(
ProductApiPaths.canonicalNamePrivate(productId),
{'canonicalName': canonicalName.trim()},
);
// ── Product merging ────────────────────────────────────────────────────────
// Admin can merge any products; users can only merge their own private products
Future<void> mergeProductsPrivate({
required int sourceProductId,
required int targetProductId,
}) =>
_postVoid(ProductApiPaths.mergePrivate, {
'sourceProductId': sourceProductId,
'targetProductId': targetProductId,
});
/// Skapar en ny aktiv produkt (kräver admin). Returnerar `{id, name, categoryId?}`.
Future<Map<String, dynamic>> createProduct(String name, {int? categoryId}) =>
_post<Map<String, dynamic>>(