update
This commit is contained in:
49
lib/features/home/domain/repositories/home_repository.dart
Normal file
49
lib/features/home/domain/repositories/home_repository.dart
Normal file
@@ -0,0 +1,49 @@
|
||||
/// Domain Repository Interface: Home Repository
|
||||
///
|
||||
/// Defines the contract for home-related data operations.
|
||||
/// This is an abstract interface following the Repository Pattern.
|
||||
///
|
||||
/// The actual implementation will be in the data layer.
|
||||
/// This allows for dependency inversion and easier testing.
|
||||
library;
|
||||
|
||||
import 'package:worker/features/home/domain/entities/member_card.dart';
|
||||
import 'package:worker/features/home/domain/entities/promotion.dart';
|
||||
|
||||
/// Home Repository Interface
|
||||
///
|
||||
/// Provides methods to:
|
||||
/// - Get member card information
|
||||
/// - Fetch active promotions
|
||||
///
|
||||
/// Implementation will be in data/repositories/home_repository_impl.dart
|
||||
abstract class HomeRepository {
|
||||
/// Get the current user's member card
|
||||
///
|
||||
/// Returns [MemberCard] with user's membership information.
|
||||
/// Throws exception if user not authenticated or data unavailable.
|
||||
///
|
||||
/// This should fetch from local cache first (Hive), then sync with server.
|
||||
Future<MemberCard> getMemberCard();
|
||||
|
||||
/// Get list of active promotions
|
||||
///
|
||||
/// Returns list of [Promotion] objects that are currently active.
|
||||
/// Returns empty list if no promotions available.
|
||||
///
|
||||
/// This should fetch from local cache first, then sync with server.
|
||||
/// Promotions should be ordered by priority/start date.
|
||||
Future<List<Promotion>> getPromotions();
|
||||
|
||||
/// Refresh member card data from server
|
||||
///
|
||||
/// Force refresh member card information from remote source.
|
||||
/// Updates local cache after successful fetch.
|
||||
Future<MemberCard> refreshMemberCard();
|
||||
|
||||
/// Refresh promotions from server
|
||||
///
|
||||
/// Force refresh promotions from remote source.
|
||||
/// Updates local cache after successful fetch.
|
||||
Future<List<Promotion>> refreshPromotions();
|
||||
}
|
||||
Reference in New Issue
Block a user