Merge "Accounts: Add method to get all accounts"
This commit is contained in:
@@ -49,6 +49,15 @@ public class Accounts {
|
|||||||
return db.accounts().get(accountId);
|
return db.accounts().get(accountId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns all accounts.
|
||||||
|
*
|
||||||
|
* @return all accounts
|
||||||
|
*/
|
||||||
|
public List<Account> all(ReviewDb db) throws OrmException {
|
||||||
|
return db.accounts().all().toList();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns all account IDs.
|
* Returns all account IDs.
|
||||||
*
|
*
|
||||||
|
@@ -29,18 +29,21 @@ import java.util.List;
|
|||||||
@Singleton
|
@Singleton
|
||||||
public class AccountsConsistencyChecker {
|
public class AccountsConsistencyChecker {
|
||||||
private final Provider<ReviewDb> dbProvider;
|
private final Provider<ReviewDb> dbProvider;
|
||||||
|
private final Accounts accounts;
|
||||||
private final ExternalIds externalIds;
|
private final ExternalIds externalIds;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
AccountsConsistencyChecker(Provider<ReviewDb> dbProvider, ExternalIds externalIds) {
|
AccountsConsistencyChecker(
|
||||||
|
Provider<ReviewDb> dbProvider, Accounts accounts, ExternalIds externalIds) {
|
||||||
this.dbProvider = dbProvider;
|
this.dbProvider = dbProvider;
|
||||||
|
this.accounts = accounts;
|
||||||
this.externalIds = externalIds;
|
this.externalIds = externalIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ConsistencyProblemInfo> check() throws OrmException, IOException {
|
public List<ConsistencyProblemInfo> check() throws OrmException, IOException {
|
||||||
List<ConsistencyProblemInfo> problems = new ArrayList<>();
|
List<ConsistencyProblemInfo> problems = new ArrayList<>();
|
||||||
|
|
||||||
for (Account account : dbProvider.get().accounts().all()) {
|
for (Account account : accounts.all(dbProvider.get())) {
|
||||||
if (account.getPreferredEmail() != null) {
|
if (account.getPreferredEmail() != null) {
|
||||||
if (!externalIds
|
if (!externalIds
|
||||||
.byAccount(account.getId())
|
.byAccount(account.getId())
|
||||||
|
Reference in New Issue
Block a user