Skip to content

Commit

Permalink
fix: providers non null
Browse files Browse the repository at this point in the history
  • Loading branch information
sattvikc committed Jul 2, 2024
1 parent bac79ce commit 29a7c6d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ static String getQueryToCreateTenantConfigsTable(Start start) {
+ "passwordless_enabled BOOLEAN,"
+ "third_party_enabled BOOLEAN,"
+ "is_first_factors_null BOOLEAN,"
+ "is_third_party_providers_null BOOLEAN,"
+ "CONSTRAINT " + Utils.getConstraintName(schema, tenantConfigsTable, null, "pkey") + " PRIMARY KEY (connection_uri_domain, app_id, tenant_id)"
+ ");";
// @formatter:on
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,12 @@ public static TenantConfigSQLHelper.TenantConfigRowMapper getInstance(ThirdParty
public TenantConfig map(ResultSet result) throws StorageQueryException {
try {
boolean isFirstFactorsNull = result.getBoolean("is_first_factors_null");
boolean isThirdPartyProvidersNull = result.getBoolean("is_third_party_providers_null");
return new TenantConfig(
new TenantIdentifier(result.getString("connection_uri_domain"), result.getString("app_id"), result.getString("tenant_id")),
new EmailPasswordConfig(result.getBoolean("email_password_enabled")),
new ThirdPartyConfig(
result.getBoolean("third_party_enabled"),
providers.length == 0 && isThirdPartyProvidersNull ? null : providers),
providers),
new PasswordlessConfig(result.getBoolean("passwordless_enabled")),
firstFactors.length == 0 && isFirstFactorsNull ? null : firstFactors,
requiredSecondaryFactors.length == 0 ? null : requiredSecondaryFactors,
Expand All @@ -75,7 +74,7 @@ public static TenantConfig[] selectAll(Start start, HashMap<TenantIdentifier, Ha
throws SQLException, StorageQueryException {
String QUERY = "SELECT connection_uri_domain, app_id, tenant_id, core_config,"
+ " email_password_enabled, passwordless_enabled, third_party_enabled, "
+ " is_first_factors_null, is_third_party_providers_null FROM "
+ " is_first_factors_null FROM "
+ getConfig(start).getTenantConfigsTable() + ";";

TenantConfig[] tenantConfigs = execute(start, QUERY, pst -> {}, result -> {
Expand Down Expand Up @@ -108,8 +107,8 @@ public static void create(Start start, Connection sqlCon, TenantConfig tenantCon
String QUERY = "INSERT INTO " + getConfig(start).getTenantConfigsTable()
+ "(connection_uri_domain, app_id, tenant_id, core_config,"
+ " email_password_enabled, passwordless_enabled, third_party_enabled,"
+ " is_first_factors_null, is_third_party_providers_null)"
+ " VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?)";
+ " is_first_factors_null)"
+ " VALUES(?, ?, ?, ?, ?, ?, ?, ?)";

update(sqlCon, QUERY, pst -> {
pst.setString(1, tenantConfig.tenantIdentifier.getConnectionUriDomain());
Expand All @@ -120,7 +119,6 @@ public static void create(Start start, Connection sqlCon, TenantConfig tenantCon
pst.setBoolean(6, tenantConfig.passwordlessConfig.enabled);
pst.setBoolean(7, tenantConfig.thirdPartyConfig.enabled);
pst.setBoolean(8, tenantConfig.firstFactors == null);
pst.setBoolean(9, tenantConfig.thirdPartyConfig.providers == null);
});
}

Expand Down

0 comments on commit 29a7c6d

Please sign in to comment.