Skip to content

Commit

Permalink
fix: PR changes
Browse files Browse the repository at this point in the history
  • Loading branch information
anku255 committed Feb 28, 2024
1 parent f2b1ef5 commit d266e53
Showing 1 changed file with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

import com.google.gson.Gson;
import com.google.gson.JsonObject;

import io.supertokens.pluginInterface.RowMapper;
import io.supertokens.pluginInterface.bulkimport.BulkImportStorage.BulkImportUserStatus;
import io.supertokens.pluginInterface.bulkimport.BulkImportUser;
Expand Down Expand Up @@ -180,9 +183,18 @@ private static BulkImportUserRowMapper getInstance() {

@Override
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"));
JsonObject flattenedJson = new JsonObject();
flattenedJson.addProperty("id", result.getString("id"));
flattenedJson.addProperty("status", result.getString("status"));
flattenedJson.addProperty("createdAt", result.getString("created_at"));
flattenedJson.addProperty("updatedAt", result.getString("updated_at"));

JsonObject rawData = new Gson().fromJson(result.getString("raw_data"), JsonObject.class);
for (var entry : rawData.entrySet()) {
flattenedJson.add(entry.getKey(), entry.getValue());
}

return BulkImportUser.fromJson(flattenedJson);
}
}
}

0 comments on commit d266e53

Please sign in to comment.