Compare commits
1 Commits
dimas_rate
...
dimas_time
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5a8a8f1197 |
@@ -17,14 +17,13 @@ public class TransactionFilter {
|
|||||||
private final CredentialService credentialService;
|
private final CredentialService credentialService;
|
||||||
|
|
||||||
public List<? extends IMoneyTransaction> filterByEmail(List<? extends IMoneyTransaction> transactions, String email) {
|
public List<? extends IMoneyTransaction> filterByEmail(List<? extends IMoneyTransaction> transactions, String email) {
|
||||||
return transactions
|
|
||||||
.stream()
|
|
||||||
.filter(transaction -> {
|
|
||||||
Optional<Credential> credential = credentialService.findByEmail(email);
|
Optional<Credential> credential = credentialService.findByEmail(email);
|
||||||
if(credential.isEmpty())
|
if(credential.isEmpty())
|
||||||
throw new UserNotFoundException("The user has not been found");
|
throw new UserNotFoundException("The user has not been found");
|
||||||
return credential.get().getUser().equals(transaction.getUser());
|
|
||||||
})
|
return transactions
|
||||||
|
.stream()
|
||||||
|
.filter(transaction -> credential.get().getUser().equals(transaction.getUser()))
|
||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user