Skip to content

Commit

Permalink
fix: Use BulkImportUser instead of BulkImportUserInfo (#200)
Browse files Browse the repository at this point in the history
* feat: Add bulk import queries

* fix: PR changes

* fix: PR changes

* fix: PR changes

* fix: PR changes

* fix: PR changes

* fix: PR changes

* fix: PR changes

* fix: PR changes

* fix: PR changes
  • Loading branch information
anku255 authored Feb 28, 2024
1 parent 6eccbf6 commit 7714471
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
3 changes: 1 addition & 2 deletions src/main/java/io/supertokens/storage/postgresql/Start.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import io.supertokens.pluginInterface.authRecipe.LoginMethod;
import io.supertokens.pluginInterface.authRecipe.sqlStorage.AuthRecipeSQLStorage;
import io.supertokens.pluginInterface.bulkimport.BulkImportUser;
import io.supertokens.pluginInterface.bulkimport.BulkImportUserInfo;
import io.supertokens.pluginInterface.bulkimport.sqlStorage.BulkImportSQLStorage;
import io.supertokens.pluginInterface.dashboard.DashboardSearchTags;
import io.supertokens.pluginInterface.dashboard.DashboardSessionInfo;
Expand Down Expand Up @@ -3065,7 +3064,7 @@ public void addBulkImportUsers(AppIdentifier appIdentifier, List<BulkImportUser>
}

@Override
public List<BulkImportUserInfo> getBulkImportUsers(AppIdentifier appIdentifier, @Nonnull Integer limit, @Nullable BulkImportUserStatus status,
public List<BulkImportUser> getBulkImportUsers(AppIdentifier appIdentifier, @Nonnull Integer limit, @Nullable BulkImportUserStatus status,
@Nullable String bulkImportUserId, @Nullable Long createdAt) throws StorageQueryException {
try {
return BulkImportQueries.getBulkImportUsers(this, appIdentifier, limit, status, bulkImportUserId, createdAt);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import io.supertokens.pluginInterface.RowMapper;
import io.supertokens.pluginInterface.bulkimport.BulkImportStorage.BulkImportUserStatus;
import io.supertokens.pluginInterface.bulkimport.BulkImportUser;
import io.supertokens.pluginInterface.bulkimport.BulkImportUserInfo;
import io.supertokens.pluginInterface.exceptions.StorageQueryException;
import io.supertokens.pluginInterface.multitenancy.AppIdentifier;
import io.supertokens.storage.postgresql.Start;
Expand Down Expand Up @@ -126,7 +125,7 @@ public static void updateBulkImportUserStatus_Transaction(Start start, Connectio
});
}

public static List<BulkImportUserInfo> getBulkImportUsers(Start start, AppIdentifier appIdentifier, @Nonnull Integer limit, @Nullable BulkImportUserStatus status,
public static List<BulkImportUser> getBulkImportUsers(Start start, AppIdentifier appIdentifier, @Nonnull Integer limit, @Nullable BulkImportUserStatus status,
@Nullable String bulkImportUserId, @Nullable Long createdAt)
throws SQLException, StorageQueryException {

Expand Down Expand Up @@ -161,27 +160,27 @@ public static List<BulkImportUserInfo> getBulkImportUsers(Start start, AppIdenti
pst.setObject(i + 1, parameters.get(i));
}
}, result -> {
List<BulkImportUserInfo> bulkImportUsers = new ArrayList<>();
List<BulkImportUser> bulkImportUsers = new ArrayList<>();
while (result.next()) {
bulkImportUsers.add(BulkImportUserInfoRowMapper.getInstance().mapOrThrow(result));
bulkImportUsers.add(BulkImportUserRowMapper.getInstance().mapOrThrow(result));
}
return bulkImportUsers;
});
}

private static class BulkImportUserInfoRowMapper implements RowMapper<BulkImportUserInfo, ResultSet> {
private static final BulkImportUserInfoRowMapper INSTANCE = new BulkImportUserInfoRowMapper();
private static class BulkImportUserRowMapper implements RowMapper<BulkImportUser, ResultSet> {
private static final BulkImportUserRowMapper INSTANCE = new BulkImportUserRowMapper();

private BulkImportUserInfoRowMapper() {
private BulkImportUserRowMapper() {
}

private static BulkImportUserInfoRowMapper getInstance() {
private static BulkImportUserRowMapper getInstance() {
return INSTANCE;
}

@Override
public BulkImportUserInfo map(ResultSet result) throws Exception {
return new BulkImportUserInfo(result.getString("id"), result.getString("raw_data"),
public BulkImportUser map(ResultSet result) throws Exception {
return BulkImportUser.fromDBJson(result.getString("id"), result.getString("raw_data"),
BulkImportUserStatus.valueOf(result.getString("status")),
result.getLong("created_at"), result.getLong("updated_at"));
}
Expand Down

0 comments on commit 7714471

Please sign in to comment.