fix news,
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
/// Use Case: Get Product Detail
|
||||
///
|
||||
/// Fetches a single product by its ID from the repository.
|
||||
library;
|
||||
|
||||
import 'package:worker/features/products/domain/entities/product.dart';
|
||||
import 'package:worker/features/products/domain/repositories/products_repository.dart';
|
||||
|
||||
/// Get Product Detail Use Case
|
||||
///
|
||||
/// Fetches detailed information for a single product by ID.
|
||||
///
|
||||
/// Usage:
|
||||
/// ```dart
|
||||
/// final getProductDetail = GetProductDetail(repository);
|
||||
/// final product = await getProductDetail(productId: 'GIB20 G02');
|
||||
/// ```
|
||||
class GetProductDetail {
|
||||
const GetProductDetail(this._repository);
|
||||
|
||||
final ProductsRepository _repository;
|
||||
|
||||
/// Execute the use case
|
||||
///
|
||||
/// [productId] - The unique identifier of the product
|
||||
/// Returns a [Product] entity
|
||||
/// Throws [Exception] if the product is not found or on error
|
||||
Future<Product> call({required String productId}) async {
|
||||
return await _repository.getProductById(productId);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user