add auth, format

This commit is contained in:
Phuoc Nguyen
2025-11-07 11:52:06 +07:00
parent 24a8508fce
commit 3803bd26e0
173 changed files with 8505 additions and 7116 deletions

View File

@@ -31,9 +31,7 @@ class PointsHistoryLocalDataSource {
/// Get all points entries
Future<List<LoyaltyPointEntryModel>> getAllEntries() async {
final box = await entriesBox;
final entries = box.values
.whereType<LoyaltyPointEntryModel>()
.toList();
final entries = box.values.whereType<LoyaltyPointEntryModel>().toList();
entries.sort((a, b) => b.timestamp.compareTo(a.timestamp)); // Newest first
return entries;
}
@@ -42,9 +40,9 @@ class PointsHistoryLocalDataSource {
Future<LoyaltyPointEntryModel?> getEntryById(String entryId) async {
final box = await entriesBox;
try {
return box.values
.whereType<LoyaltyPointEntryModel>()
.firstWhere((entry) => entry.entryId == entryId);
return box.values.whereType<LoyaltyPointEntryModel>().firstWhere(
(entry) => entry.entryId == entryId,
);
} catch (e) {
throw Exception('Entry not found');
}