Skip to content

Commit 2731b9b

Browse files
authored
fix: Use fromJson method instead of fromDBJson in BulkImportUser (#201)
* 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 * fix: PR changes * fix: PR changes
1 parent 7714471 commit 2731b9b

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/main/java/io/supertokens/storage/postgresql/Start.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -3064,7 +3064,7 @@ public void addBulkImportUsers(AppIdentifier appIdentifier, List<BulkImportUser>
30643064
}
30653065

30663066
@Override
3067-
public List<BulkImportUser> getBulkImportUsers(AppIdentifier appIdentifier, @Nonnull Integer limit, @Nullable BulkImportUserStatus status,
3067+
public List<BulkImportUser> getBulkImportUsers(AppIdentifier appIdentifier, @Nonnull Integer limit, @Nullable BULK_IMPORT_USER_STATUS status,
30683068
@Nullable String bulkImportUserId, @Nullable Long createdAt) throws StorageQueryException {
30693069
try {
30703070
return BulkImportQueries.getBulkImportUsers(this, appIdentifier, limit, status, bulkImportUserId, createdAt);
@@ -3074,7 +3074,7 @@ public List<BulkImportUser> getBulkImportUsers(AppIdentifier appIdentifier, @Non
30743074
}
30753075

30763076
@Override
3077-
public void updateBulkImportUserStatus_Transaction(AppIdentifier appIdentifier, TransactionConnection con, @Nonnull String[] bulkImportUserIds, @Nonnull BulkImportUserStatus status)
3077+
public void updateBulkImportUserStatus_Transaction(AppIdentifier appIdentifier, TransactionConnection con, @Nonnull String[] bulkImportUserIds, @Nonnull BULK_IMPORT_USER_STATUS status)
30783078
throws StorageQueryException {
30793079
Connection sqlCon = (Connection) con.getConnection();
30803080
try {

src/main/java/io/supertokens/storage/postgresql/queries/BulkImportQueries.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
import javax.annotation.Nullable;
3030

3131
import io.supertokens.pluginInterface.RowMapper;
32-
import io.supertokens.pluginInterface.bulkimport.BulkImportStorage.BulkImportUserStatus;
32+
import io.supertokens.pluginInterface.bulkimport.BulkImportStorage.BULK_IMPORT_USER_STATUS;
3333
import io.supertokens.pluginInterface.bulkimport.BulkImportUser;
3434
import io.supertokens.pluginInterface.exceptions.StorageQueryException;
3535
import io.supertokens.pluginInterface.multitenancy.AppIdentifier;
@@ -87,12 +87,12 @@ public static void insertBulkImportUsers(Start start, AppIdentifier appIdentifie
8787
for (BulkImportUser user : users) {
8888
pst.setString(parameterIndex++, user.id);
8989
pst.setString(parameterIndex++, appIdentifier.getAppId());
90-
pst.setString(parameterIndex++, user.toString());
90+
pst.setString(parameterIndex++, user.toRawDataForDbStorage());
9191
}
9292
});
9393
}
9494

95-
public static void updateBulkImportUserStatus_Transaction(Start start, Connection con, AppIdentifier appIdentifier, @Nonnull String[] bulkImportUserIds, @Nonnull BulkImportUserStatus status)
95+
public static void updateBulkImportUserStatus_Transaction(Start start, Connection con, AppIdentifier appIdentifier, @Nonnull String[] bulkImportUserIds, @Nonnull BULK_IMPORT_USER_STATUS status)
9696
throws SQLException, StorageQueryException {
9797
if (bulkImportUserIds.length == 0) {
9898
return;
@@ -125,7 +125,7 @@ public static void updateBulkImportUserStatus_Transaction(Start start, Connectio
125125
});
126126
}
127127

128-
public static List<BulkImportUser> getBulkImportUsers(Start start, AppIdentifier appIdentifier, @Nonnull Integer limit, @Nullable BulkImportUserStatus status,
128+
public static List<BulkImportUser> getBulkImportUsers(Start start, AppIdentifier appIdentifier, @Nonnull Integer limit, @Nullable BULK_IMPORT_USER_STATUS status,
129129
@Nullable String bulkImportUserId, @Nullable Long createdAt)
130130
throws SQLException, StorageQueryException {
131131

@@ -180,8 +180,8 @@ private static BulkImportUserRowMapper getInstance() {
180180

181181
@Override
182182
public BulkImportUser map(ResultSet result) throws Exception {
183-
return BulkImportUser.fromDBJson(result.getString("id"), result.getString("raw_data"),
184-
BulkImportUserStatus.valueOf(result.getString("status")),
183+
return BulkImportUser.fromRawDataFromDbStorage(result.getString("id"), result.getString("raw_data"),
184+
BULK_IMPORT_USER_STATUS.valueOf(result.getString("status")),
185185
result.getLong("created_at"), result.getLong("updated_at"));
186186
}
187187
}

0 commit comments

Comments
 (0)