Implement admin inventory management features including CRUD operations, merging, filtering, sorting, previewing, and security enhancements. Update documentation and add comprehensive test coverage for security and validation.
Test Suite / test (24.15.0) (push) Has been cancelled

This commit is contained in:
Nils-Johan Gynther
2026-05-10 00:20:25 +02:00
parent 65137b41fb
commit 1709bb1dad
33 changed files with 1879 additions and 71 deletions
+19
View File
@@ -63,6 +63,25 @@ class InventoryApiPaths {
static String consumptionHistory(int id) => '/inventory/$id/consumption-history';
}
class AdminInventoryApiPaths {
static const list = '/inventory/admin';
static String withFilters({int? userId, String? sort}) {
final params = <String, String>{};
if (userId != null) params['userId'] = '$userId';
if (sort != null && sort.isNotEmpty) params['sort'] = sort;
if (params.isEmpty) return list;
final query = params.entries
.map((e) => '${Uri.encodeQueryComponent(e.key)}=${Uri.encodeQueryComponent(e.value)}')
.join('&');
return '$list?$query';
}
static String update(int id) => '/inventory/admin/$id';
static String remove(int id) => '/inventory/admin/$id';
static const merge = '/inventory/admin/merge';
static String mergePreview(int sourceInventoryId, int targetInventoryId) =>
'/inventory/admin/merge-preview?sourceInventoryId=$sourceInventoryId&targetInventoryId=$targetInventoryId';
}
class PantryApiPaths {
static const list = '/pantry';
static String remove(int id) => '/pantry/$id';