feat: add isPrivate field to Product model and implement private product creation and retrieval
This commit is contained in:
@@ -142,6 +142,23 @@ class AdminRepository {
|
||||
.toList();
|
||||
}
|
||||
|
||||
/// Skapar en ny aktiv produkt (kräver admin). Returnerar `{id, name, categoryId?}`.
|
||||
Future<Map<String, dynamic>> createProduct(String name, {int? categoryId}) async {
|
||||
final token = await _token();
|
||||
final data = await guardedApiCall(
|
||||
_ref,
|
||||
() => _apiClient.postJson(
|
||||
ProductApiPaths.list,
|
||||
body: {
|
||||
'name': name.trim(),
|
||||
if (categoryId != null) 'categoryId': categoryId,
|
||||
},
|
||||
token: token,
|
||||
),
|
||||
);
|
||||
return data as Map<String, dynamic>;
|
||||
}
|
||||
|
||||
Future<List<AdminProduct>> listDeletedProducts() async {
|
||||
final token = await _token();
|
||||
final data = await guardedApiCall(
|
||||
|
||||
Reference in New Issue
Block a user