Front v3 #42

Merged
bytegrip merged 6 commits from front-v3 into master 2023-12-08 17:57:53 +00:00
Showing only changes of commit b5742b9761 - Show all commits

View File

@@ -17,14 +17,13 @@ public class TransactionFilter {
private final CredentialService credentialService;
public List<? extends IMoneyTransaction> filterByEmail(List<? extends IMoneyTransaction> transactions, String email) {
Optional<Credential> credential = credentialService.findByEmail(email);
if(credential.isEmpty())
throw new UserNotFoundException("The user has not been found");
return transactions
.stream()
.filter(transaction -> {
Optional<Credential> credential = credentialService.findByEmail(email);
if(credential.isEmpty())
throw new UserNotFoundException("The user has not been found");
return credential.get().getUser().equals(transaction.getUser());
})
.filter(transaction -> credential.get().getUser().equals(transaction.getUser()))
.toList();
}