feat: add rows count (broken), fix: bug with low stock items
This commit is contained in:
@@ -4,6 +4,13 @@ import 'package:uuid/uuid.dart';
|
||||
import '../database/app_database.dart';
|
||||
import '../models/product.dart';
|
||||
|
||||
class InsufficientStockException implements Exception {
|
||||
const InsufficientStockException();
|
||||
|
||||
@override
|
||||
String toString() => 'Not enough stock';
|
||||
}
|
||||
|
||||
abstract class ProductService {
|
||||
Future<List<Product>> getProducts();
|
||||
|
||||
@@ -130,7 +137,7 @@ class DriftProductService implements ProductService {
|
||||
}
|
||||
|
||||
if (product.stockQuantity < amount) {
|
||||
throw Exception('Not enough stock');
|
||||
throw const InsufficientStockException();
|
||||
}
|
||||
|
||||
await updateProduct(
|
||||
|
||||
Reference in New Issue
Block a user