fix news,

This commit is contained in:
Phuoc Nguyen
2025-11-11 11:34:23 +07:00
parent 47cdf71968
commit b5afeed534
12 changed files with 439 additions and 278 deletions

View File

@@ -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);
}
}