feat: add private product management endpoints for updating canonical names and merging products
Test Suite / test (24.15.0) (push) Has been cancelled
Test Suite / test (24.15.0) (push) Has been cancelled
This commit is contained in:
@@ -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>>(
|
||||
|
||||
Reference in New Issue
Block a user