feat: Implement admin pantry item management with create and update functionality, including category selection and validation
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:
@@ -436,6 +436,38 @@ class AdminRepository {
|
||||
Future<void> removeAdminPantryItem(int pantryItemId) =>
|
||||
_deleteVoid(PantryApiPaths.adminRemove(pantryItemId));
|
||||
|
||||
Future<AdminPantryItem> createAdminPantry({
|
||||
int? userId,
|
||||
required int productId,
|
||||
String? location,
|
||||
}) {
|
||||
return _post<AdminPantryItem>(
|
||||
PantryApiPaths.adminCreate,
|
||||
body: {
|
||||
if (userId != null) 'userId': userId,
|
||||
'productId': productId,
|
||||
if (location != null && location.trim().isNotEmpty)
|
||||
'location': location.trim(),
|
||||
},
|
||||
parse: (d) => AdminPantryItem.fromJson(Map<String, dynamic>.from(d as Map)),
|
||||
);
|
||||
}
|
||||
|
||||
Future<AdminPantryItem> updateAdminPantry(
|
||||
int pantryItemId, {
|
||||
int? productId,
|
||||
String? location,
|
||||
}) {
|
||||
return _patch(
|
||||
PantryApiPaths.adminUpdate(pantryItemId),
|
||||
body: {
|
||||
if (productId != null) 'productId': productId,
|
||||
if (location != null) 'location': location,
|
||||
},
|
||||
parse: AdminPantryItem.fromJson,
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> moveAdminPantryToInventory(
|
||||
int pantryItemId,
|
||||
Map<String, dynamic> body,
|
||||
|
||||
Reference in New Issue
Block a user