This commit is contained in:
@@ -220,4 +220,50 @@ class AnalyticRepository implements IAnalyticRepository {
|
||||
return left(const AnalyticFailure.unexpectedError());
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Either<AnalyticFailure, ProfitSharing>> getProfitSharing({
|
||||
required DateTime dateFrom,
|
||||
required DateTime dateTo,
|
||||
String? outletId,
|
||||
String groupBy = 'day',
|
||||
}) async {
|
||||
try {
|
||||
final result = await _dataProvider.fetchProfitSharing(
|
||||
dateFrom: dateFrom,
|
||||
dateTo: dateTo,
|
||||
outletId: _resolveOutletId(outletId),
|
||||
groupBy: groupBy,
|
||||
);
|
||||
|
||||
if (result.hasError) return left(result.error!);
|
||||
return right(result.data!.toDomain());
|
||||
} catch (e, s) {
|
||||
log('getProfitSharingError', name: _logName, error: e, stackTrace: s);
|
||||
return left(const AnalyticFailure.unexpectedError());
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Either<AnalyticFailure, ProfitSharingDetail>> getProfitSharingDetail({
|
||||
required String parentCategoryId,
|
||||
required DateTime dateFrom,
|
||||
required DateTime dateTo,
|
||||
String? outletId,
|
||||
}) async {
|
||||
try {
|
||||
final result = await _dataProvider.fetchProfitSharingDetail(
|
||||
parentCategoryId: parentCategoryId,
|
||||
dateFrom: dateFrom,
|
||||
dateTo: dateTo,
|
||||
outletId: _resolveOutletId(outletId),
|
||||
);
|
||||
|
||||
if (result.hasError) return left(result.error!);
|
||||
return right(result.data!.toDomain());
|
||||
} catch (e, s) {
|
||||
log('getProfitSharingDetailError', name: _logName, error: e, stackTrace: s);
|
||||
return left(const AnalyticFailure.unexpectedError());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user