Skip to content

Commit

Permalink
feat(schemas): add suppport email and website url to sie (#6789)
Browse files Browse the repository at this point in the history
* feat(schemas): add suppport email and website url to sie

add support email and website url to sie

* fix(experience): fix type issue

fix type issue

* fix(core): fix ut

fix ut
  • Loading branch information
simeng-li authored Nov 12, 2024
1 parent f4a374f commit 1cee704
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 1 deletion.
2 changes: 2 additions & 0 deletions packages/core/src/__mocks__/sign-in-experience.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,6 @@ export const mockSignInExperience: SignInExperience = {
},
singleSignOnEnabled: true,
socialSignIn: {},
supportEmail: null,
supportWebsiteUrl: null,
};
2 changes: 1 addition & 1 deletion packages/core/src/queries/sign-in-experience.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe('sign-in-experience query', () => {
it('findDefaultSignInExperience', async () => {
/* eslint-disable sql/no-unsafe-query */
const expectSql = `
select "tenant_id", "id", "color", "branding", "language_info", "terms_of_use_url", "privacy_policy_url", "agree_to_terms_policy", "sign_in", "sign_up", "social_sign_in", "social_sign_in_connector_targets", "sign_in_mode", "custom_css", "custom_content", "custom_ui_assets", "password_policy", "mfa", "single_sign_on_enabled"
select "tenant_id", "id", "color", "branding", "language_info", "terms_of_use_url", "privacy_policy_url", "agree_to_terms_policy", "sign_in", "sign_up", "social_sign_in", "social_sign_in_connector_targets", "sign_in_mode", "custom_css", "custom_content", "custom_ui_assets", "password_policy", "mfa", "single_sign_on_enabled", "support_email", "support_website_url"
from "sign_in_experiences"
where "id"=$1
`;
Expand Down
4 changes: 4 additions & 0 deletions packages/experience-legacy/src/__mocks__/logto.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ export const mockSignInExperience: SignInExperience = {
},
singleSignOnEnabled: true,
socialSignIn: {},
supportEmail: null,
supportWebsiteUrl: null,
};

export const mockSignInExperienceSettings: SignInExperienceResponse = {
Expand Down Expand Up @@ -149,6 +151,8 @@ export const mockSignInExperienceSettings: SignInExperienceResponse = {
isDevelopmentTenant: false,
singleSignOnEnabled: true,
socialSignIn: {},
supportEmail: null,
supportWebsiteUrl: null,
};

const usernameSettings = {
Expand Down
4 changes: 4 additions & 0 deletions packages/experience/src/__mocks__/logto.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ export const mockSignInExperience: SignInExperience = {
},
singleSignOnEnabled: true,
socialSignIn: {},
supportEmail: null,
supportWebsiteUrl: null,
};

export const mockSignInExperienceSettings: SignInExperienceResponse = {
Expand Down Expand Up @@ -149,6 +151,8 @@ export const mockSignInExperienceSettings: SignInExperienceResponse = {
isDevelopmentTenant: false,
singleSignOnEnabled: true,
socialSignIn: {},
supportEmail: null,
supportWebsiteUrl: null,
};

const usernameSettings = {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { sql } from '@silverhand/slonik';

import type { AlterationScript } from '../lib/types/alteration.js';

const alteration: AlterationScript = {
up: async (pool) => {
await pool.query(sql`
alter table sign_in_experiences
add column support_email text,
add column support_website_url text;
`);
},
down: async (pool) => {
await pool.query(sql`
alter table sign_in_experiences
drop column support_email,
drop column support_website_url;
`);
},
};

export default alteration;
2 changes: 2 additions & 0 deletions packages/schemas/tables/sign_in_experiences.sql
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,7 @@ create table sign_in_experiences (
password_policy jsonb /* @use PartialPasswordPolicy */ not null default '{}'::jsonb,
mfa jsonb /* @use Mfa */ not null default '{}'::jsonb,
single_sign_on_enabled boolean not null default false,
support_email text,
support_website_url text,
primary key (tenant_id, id)
);

0 comments on commit 1cee704

Please sign in to comment.