TF-801 Add domain layer for get all vacation

This commit is contained in:
dab246
2022-08-17 17:30:24 +07:00
committed by Dat H. Pham
parent c171f5fc24
commit da05650278
3 changed files with 56 additions and 0 deletions
@@ -0,0 +1,24 @@
import 'dart:core';
import 'package:core/presentation/state/failure.dart';
import 'package:core/presentation/state/success.dart';
import 'package:dartz/dartz.dart';
import 'package:jmap_dart_client/jmap/account_id.dart';
import 'package:tmail_ui_user/features/manage_account/domain/repository/manage_account_repository.dart';
import 'package:tmail_ui_user/features/manage_account/domain/state/get_all_vacation_state.dart';
class GetAllVacationInteractor {
final ManageAccountRepository manageAccountRepository;
GetAllVacationInteractor(this.manageAccountRepository);
Stream<Either<Failure, Success>> execute(AccountId accountId) async* {
try {
yield Right<Failure, Success>(LoadingGetAllVacation());
final listVacationResponse = await manageAccountRepository.getAllVacationResponse(accountId);
yield Right<Failure, Success>(GetAllVacationSuccess(listVacationResponse));
} catch (exception) {
yield Left<Failure, Success>(GetAllVacationFailure(exception));
}
}
}