fill
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import 'package:dartz/dartz.dart';
|
||||
import '../../../../core/errors/failures.dart';
|
||||
import '../entities/product_entity.dart';
|
||||
import '../repositories/products_repository.dart';
|
||||
|
||||
/// Use case for getting products
|
||||
/// Encapsulates the business logic for fetching products
|
||||
class GetProductsUseCase {
|
||||
final ProductsRepository repository;
|
||||
|
||||
GetProductsUseCase(this.repository);
|
||||
|
||||
/// Execute the use case
|
||||
///
|
||||
/// [warehouseId] - The ID of the warehouse to get products from
|
||||
/// [type] - The operation type ('import' or 'export')
|
||||
///
|
||||
/// Returns Either<Failure, List<ProductEntity>>
|
||||
Future<Either<Failure, List<ProductEntity>>> call(
|
||||
int warehouseId,
|
||||
String type,
|
||||
) async {
|
||||
return await repository.getProducts(warehouseId, type);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user